kb/data/developer.mozilla.org/en-US/docs/Glossary/Debounce-0.md

11 KiB

title chunk source category tags date_saved instance
Debounce - Glossary | MDN 1/3 https://developer.mozilla.org/en-US/docs/Glossary/Debounce reference web, html, css, javascript, documentation 2026-05-05T05:29:20.487495+00:00 kb-cron

MDN HTML HTML: Markup language

HTML reference

HTML guides

Markup languages

CSS CSS: Styling language

CSS reference

CSS guides

Layout cookbook

JavaScriptJS JavaScript: Scripting language

JS reference

JS guides

Web APIs Web APIs: Programming interfaces

Web API reference

Web API guides

All All web technology

Technologies

Topics

Learn Learn web development

Frontend developer course

Learn HTML

Learn CSS

Learn JavaScript

Tools Discover our tools

About Get to know MDN better

Blog

  1. Glossary
  2. Debounce

Debounce

Debouncing , in the context of programming, means to discard operations that occur too close together during a specific interval, and consolidate them into a single invocation. Debouncing is very similar to throttling. The key difference is that throttling enforces limits on continuous operations, while debouncing waits for invocations to stop for a specific time to consolidate many noisy invocations into one single invocation. A typical use case of debouncing is when responding to user input. When the user is typing, no other action should be taken to avoid the UI becoming laggy. When the user pauses typing, we can start processing the input, such as filtering results, giving suggestions, etc. If the function search is debounced by 10 milliseconds, it means:

  1. The first call to search is known as the leading edge.
  2. For every next call to search, if it is within 10 milliseconds from the previous call, it is in the same "batch" as the previous call.
  3. After 10 milliseconds have elapsed from the last call to search, if no other calls have happened, we have reached the trailing edge.

Usually, search is executed once on the trailing edge only, although sometimes it might be executed on the leading edge, or even both edges, depending on the specific use case. If executed on both edges, the debouncing implementation usually also ensures that the next leading edge invocation doesn't fire at least 10 milliseconds after the previous trailing edge.

In this article

See also