The Console API provides functionality to allow developers to perform debugging tasks, such as logging messages or the values of variables at set points in your code, or timing how long an operation takes to complete.
Concepts and usage
The Console API started as a largely proprietary API, with different browsers implementing it, albeit it in inconsistent ways. The Console API spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. Find out about these at:
Usage is very simple — the console
object — available via window.console
, or WorkerGlobalScope.console
in workers; accessible using just console
— contains many methods that you can call to perform rudimentary debugging tasks, generally focused around logging various values to the browser's Web Console.
By far the most commonly-used method is console.log
, which is used to log the current value contained inside a specific variable.
Interfaces
console
- Provides rudimentary debugging functionality, including logging, stack traces, timers, and counters.
Examples
let myString = 'Hello world';
// Output "Hello world" to the console
console.log(myString)
See the Console reference page for more examples.
Specifications
Specification | Status | Comment |
Console API | Living Standard | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Console
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE Full support 8 Full support 8 Notes' In Internet Explorer 8 and 9, the |
Opera
Full support 10.5 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
assert
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 28 |
IE
Full support 8 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 28 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
clear
|
Chrome
Full support 25 |
Edge
Full support 12 |
Firefox
Full support 39 |
IE
Full support 8 |
Opera
Full support 12 |
Safari
Full support 6.1 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 25 |
Firefox Android
Full support 39 |
Opera Android
Full support 12 |
Safari iOS
Full support 7 |
Samsung Internet Android
Full support 1.5 |
count
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 30 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 30 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
countReset
|
Chrome
Full support 68 |
Edge
Full support 79 |
Firefox
Full support 62 |
IE
No support No |
Opera
Full support 55 |
Safari
Full support 13 |
WebView Android
Full support 68 |
Chrome Android
Full support 68 |
Firefox Android
Full support 62 |
Opera Android
Full support 48 |
Safari iOS
Full support 13 |
Samsung Internet Android
Full support 10.0 |
debug
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 10 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 8 |
IE
Full support 9 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 8 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 | |
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 39 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 39 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 | |
error
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 8 |
Opera
Full support 10.5 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Chrome
No support No |
Edge
No support 13 — 79 |
Firefox
Full support 28 |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
Full support 28 |
Opera Android
? |
Safari iOS
No support No |
Samsung Internet Android
No support No | |
group
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
groupCollapsed
|
Chrome
Full support 6 |
Edge
Full support 12 |
Firefox
Full support 9 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 5.1 |
WebView Android
Full support 37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 9 |
Opera Android
Full support 11 |
Safari iOS
Full support 5.1 |
Samsung Internet Android
Full support 1.0 |
groupEnd
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 9 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 9 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
info
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 8 |
Opera
Full support 10.5 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
log
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 8 |
Opera
Full support 10.5 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Chrome
Full support 4 |
Edge
Full support 12 |
Firefox
Full support 16 |
IE
Full support 9 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 16 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 | |
Chrome
Full support 4 |
Edge
Full support 12 |
Firefox
Full support 16 |
IE
Full support 9 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 16 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 | |
table
|
Chrome
Full support 27 |
Edge
Full support 13 |
Firefox
Full support 34 |
IE
No support No |
Opera
Full support 11 |
Safari
Full support 6.1 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 27 |
Firefox Android
Full support 34 |
Opera Android
Full support 11 |
Safari iOS
Full support 7 |
Samsung Internet Android
Full support 1.5 |
time
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 10 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 10 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
timeEnd
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 10 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 10 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
timeLog
|
Chrome
Full support 71 |
Edge
Full support 79 |
Firefox
Full support 62 |
IE
No support No |
Opera
Full support 60 |
Safari
Full support 13 |
WebView Android
Full support 71 |
Chrome Android
Full support 71 |
Firefox Android
Full support 62 |
Opera Android
Full support 50 |
Safari iOS
Full support 13 |
Samsung Internet Android
Full support 10.0 |
Chrome
Full support 14 |
Edge
Full support 12 |
Firefox
Full support 39 |
IE
Full support 11 |
Opera
Full support 15 |
Safari
Full support 6 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 39 |
Opera Android
Full support 14 |
Safari iOS
Full support 6 |
Samsung Internet Android
Full support 1.0 | |
trace
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 10 |
IE
Full support 11 |
Opera
Full support 11 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 10 |
Opera Android
Full support 11 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 1.0 |
warn
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 8 |
Opera
Full support 10.5 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 11 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Available in workers | Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support 38 |
IE
Full support Yes |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 38 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.'
- Deprecated. Not for use in new websites.
- See implementation notes.'
- See implementation notes.
See also
- Tools
- Web Console — how the Web Console in Firefox handles console API calls
- Remote debugging — how to see console output when the debugging target is a mobile device
Console API by Mozilla Contributors is licensed under CC-BY-SA 2.5.