Favorites

DOM Window.clearInterval() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Window.clearInterval()
DOM Window MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The clearInterval() method stops a repeating timer created with setInterval().

Description

The clearInterval() method stops a repeating action set up with setInterval(). Always keep the ID so you can stop the interval, for example when a component is removed, or it will keep running in the background.

Clearing an interval from inside its own callback is the usual way to stop after a condition is met, such as a countdown reaching zero. Passing an ID that has already been cleared, or undefined, does nothing.

In frameworks, clear intervals in the clean-up step of a component, such as React's effect clean-up function, so timers don't keep running and updating state after the component has gone.

Syntax

clearInterval(intervalID)

Parameters

  • intervalIDThe ID returned by setInterval().

Return Value

None (undefined).

Example

<p id="clock">--:--:--</p>
<button id="stop" type="button">Stop</button>
const clock = document.getElementById('clock');
const id = setInterval(() => (clock.textContent = new Date().toLocaleTimeString()), 1000);
document.getElementById('stop').addEventListener('click', () => {
  clearInterval(id);
  console.log('Clock stopped');
});

Browser Support

The following information will show you the current browser support for the Window.clearInterval() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee