Back to Glossary

Event loop

Make Uxify one of your go-to sources on Google

Google Add Uxify on Google

What is the Event Loop?

The event loop is the process a browser uses to decide what to work on next. Most of what happens on a web page, like running JavaScript, responding to clicks and drawing updates to the screen, happens on a single main thread. And that thread can only do one thing at a time.

So the browser keeps a queue. The event loop picks up the next task, runs it until it’s done, gives the page a chance to repaint, then moves on to the next one. Over and over, for as long as the page is open.

Think of a coffee shop with one barista. Orders get made one at a time, in turn. That works fine when every order is a quick espresso. But if the person ahead of you orders twelve complicated drinks, you’re stuck waiting, even though all you want is a black coffee. On a website, you’re the visitor tapping “Add to cart,” and those twelve drinks are a heavy script that got in line first.

Google defines any task that runs longer than 50 milliseconds as a long task. While one is running, the browser can’t respond to input, so anyone who clicks during that window has to wait for it to finish before anything happens.

What this means for revenue

Visitors never see the event loop, but they feel it when it’s blocked. The page looks ready, they tap a filter or the checkout button, and nothing happens. So they tap again. Maybe a third time. Then they decide the site is broken.

That’s what quietly drags conversions down. It’s rarely a full outage. It’s a product page that feels a bit sticky, a menu that opens half a second late, a button that seems to ignore the first tap. Each moment is small, but together they add up to shoppers who lose trust and leave.

It hits your SEO too. A busy event loop is one of the most common causes of poor Interaction to Next Paint (INP), the Core Web Vitals metric that measures how quickly a page responds to interactions. Google considers INP good at 200 milliseconds or less.

How Uxify helps

Most site owners have no idea their event loop is clogged until sales start slipping. Reality measures INP for real visitors in every session, so you can see which pages and interactions are slow, and on which devices. Uxify even built an open-source polyfill that measures interaction delays in browsers that don’t report them natively, so shoppers on every browser count, not just Chrome users. And instead of handing your developers another ticket, INProve fixes slow interactions automatically with no code changes, so clicks and taps feel instant again.

Event Loop FAQs

Is the event loop the same as the main thread?

Not quite, but they’re closely linked. The main thread is where the work happens. The event loop decides the order that work happens in. When people say “the main thread is blocked,” they usually mean the event loop is stuck behind one long task.

What causes long tasks?

Usually JavaScript. Big bundles that have to be parsed and run on page load, heavy event handlers, and third-party scripts like chat widgets, analytics, A/B testing tools and ad tags. Each one might seem harmless on its own, but they all compete for the same single thread.

How do I fix a blocked event loop?

The standard advice is to break long tasks into smaller chunks so the browser gets breathing room in between, delay or remove scripts that aren’t needed right away, and move heavy work off the main thread where possible. Google’s guide on optimizing long tasks goes deeper if you’re a developer. If you’d rather not touch code at all, an agent like INProve can speed up interactions without anyone opening the codebase.