Format console messages

Help us make DevTools Tips better! Fill out this survey to tell us more about your DevTools habits and frustrations.

Categories: Supported by:

Format console messages

You can use special formatters in the console.log function to format logs just the way you want.

As a bonus, the %c formatter can also be used to style console messages with CSS properties!

var el = document.body;
console.log('%c There are %d elements in %O', 'color:lime;background:black;', el.childElementCount, el);

A formatted console message in Edge.

See also