This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
Note: This feature is available in Web Workers.
The clearMarks() method removes all or specific PerformanceMark objects from the browser's performance timeline.
clearMarks() clearMarks(name)
name OptionalA string representing the name of the PerformanceMark object. If this argument is omitted, all entries with an entryType of "mark" will be removed.
None (undefined).
To clean up all performance marks, or just specific entries, use the clearMarks() method like this:
// Create a bunch of marks
performance.mark("login-started");
performance.mark("login-started");
performance.mark("login-finished");
performance.mark("form-sent");
performance.mark("video-loaded");
performance.mark("video-loaded");
performance.getEntriesByType("mark").length; // 6
// Delete just the "login-started" mark entries
performance.clearMarks("login-started");
performance.getEntriesByType("mark").length; // 4
// Delete all of the mark entries
performance.clearMarks();
performance.getEntriesByType("mark").length; // 0
| Specification |
|---|
| User Timing> # dom-performance-clearmarks> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
clearMarks |
2925–29 | 12 | 38 | 33 | 11 | 2925–29 | 42 | 33 | 11 | 2.01.5–2.0 | 4.4 | 11 |
© 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/Performance/clearMarks