This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The console.clear() static method clears the console if possible.
A graphical console, like those in web browsers, will remove all previous messages; a console displaying on a terminal, like the one in Node.js, will attempt to clear it using an escape code or system API; otherwise the method will have no effect (and no error).
console.clear()
None.
None (undefined).
| Specification |
|---|
| Console> # clear> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
clear_static |
25 | 12 | 39 | 12 | 7 | 25 | 39 | 12 | 7 | 1.5 | 4.4 | 7 |
console.clear()console.clear()console.clear()
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/console/clear_static