Always store real IDs from setTimeout in practice.
Compatibility
Browser Support
Window.clearTimeout() is marked Baseline Widely available on MDN (since July 2015). Browser Window API — also available in workers.
✓ Baseline · Widely available
clearTimeout()
Cancel one-shot timers across modern browsers.
99%Core tag support
ChromeYes
Full support
EdgeYes
Full support
FirefoxYes
Full support
SafariYes
Full support
OperaYes
Full support
HTML element100% supported
Bottom line: Safe everywhere you use setTimeout. Always clear pending timeouts that should not run.
Frequently Asked Questions
It cancels a one-shot timer previously started with setTimeout(). After you clear that ID, the callback will not run unless you schedule a new timeout.
No. MDN marks Window.clearTimeout() as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
The timeout ID returned by setTimeout(). Store that ID in a variable so you can pass it later.
undefined. It cancels the timer as a side effect; there is no useful return value.
Technically yes — setTimeout and setInterval share one ID pool, so clearTimeout and clearInterval can cancel either. Prefer matching names for clarity.
clearTimeout() does nothing. Calling it twice, after the callback ran, or with an unknown ID is safe.