Interaction to Next Paint (INP): How JavaScript, Main-Thread Work and Event Handlers Affect Responsiveness

Why a page that loads fast can still feel sluggish, how to find the exact slow interaction, and why cutting bundle size often does not help.

In short

Interaction to Next Paint measures how long it takes your page to visibly react when someone taps or clicks. Google wants that within 200 milliseconds — a fifth of a second — for at least three quarters of your visitors.

A slow INP is almost always the same story: the browser was busy running JavaScript at the moment the visitor tapped, and it could not do two things at once. The tap waited in a queue.

The important consequence, and the reason so much INP work fails: making your JavaScript files smaller does not reliably help. INP is about how long your code runs, not how much of it there is. A 50 KB script that blocks the main thread for 400 ms is far worse for INP than a 500 KB script that never blocks it.

What INP actually measures

When someone interacts with your page — a tap, a click, or a key press — the browser has to do three things in sequence before the screen can change. INP is the total time for all three.

It watches interactions for the whole time the visitor is on the page, and reports a value close to the worst one. Not the average. If 99 interactions are instant and one takes 900 ms, your INP reflects the 900 ms one.

Scrolling and hovering do not count. Only discrete interactions.

The thresholds

RatingINP
Good200 ms or less
Needs improvement200 – 500 ms
PoorOver 500 ms

For a sense of scale: 100 ms feels instant, 200 ms feels responsive, 500 ms feels like the page is thinking, and a second feels broken.

Why it replaced First Input Delay

INP became a Core Web Vital in 2024, replacing First Input Delay. FID measured only the delay before the browser started handling the first interaction — not how long the handling took, and not any interaction after the first. A page could score a perfect FID while every click took a second to do anything.

If you are reading advice that still treats FID as current, it is out of date.

The three phases

This is what makes INP diagnosable. The total splits into three parts, and each has different fixes.

#PhaseWhat is happening
1Input delayThe visitor has tapped, but the browser cannot start your handler yet because the main thread is busy with something else.
2Processing durationYour event handler is running.
3Presentation delayThe handler has finished, and the browser is recalculating layout and painting the new frame.

Input delay — the browser was busy

The main thread is where the browser parses HTML, calculates styles, lays out the page, paints, and runs all your JavaScript. It does one thing at a time.

If a script is in the middle of a 300 ms task when the visitor taps, the tap cannot be handled for 300 ms. Your handler has not even started. This is input delay, and it is usually the largest of the three phases on a slow page.

The culprits are typically work that has nothing to do with the interaction: a third-party script initialising, a framework hydrating the page, an analytics payload being assembled, or a large list being rendered.

Processing duration — your handler is slow

Your own code doing too much in one go: recalculating a cart total by looping over everything, writing to localStorage synchronously, rebuilding a large part of the page, or doing work that did not need to happen before the screen updated.

Presentation delay — the page is expensive to draw

Your handler finished quickly but the browser still has to produce the new frame. A very large DOM, deeply nested layouts, expensive CSS, or a change that forces the browser to re-lay-out the entire page all land here.

Why INP is so much worse on phones

A mid-range phone runs JavaScript several times slower than a development laptop, and it throttles further as it heats up. The same handler that takes 60 ms on your desk can take 300 ms in a visitor's hand.

This is why a page can feel perfect while you build it and feel broken to most of your audience. INP is the Core Web Vital most distorted by testing on fast hardware.

How to find your slow interaction

Step 1 — find out whether you have a problem, and where

Field data first. In PageSpeed Insights, the real-user section shows your INP. In Search Console, the Core Web Vitals report groups URLs by issue, which tells you whether this is one page or a template used across the site.

Field data will not tell you which interaction is slow. It tells you that one is.

Step 2 — reproduce it on a throttled machine

  1. Open the page in Chrome.
  2. Open DevTools → Performance.
  3. Set CPU to 4x slowdown. This matters more than network throttling for INP.
  4. Click Record, then use the page the way a visitor would — open the menu, pick a variant, apply a filter, add to cart.
  5. Stop recording.

Step 3 — read the interaction

In the recording, find the Interactions track. Each interaction appears as a bar, and a long one is usually marked.

Click the slowest bar. You should see it broken into the three phases, and below it the Main thread track showing exactly what was running.

What you should see: either a long task occupying the thread before your handler starts (input delay), or your own handler taking a long time (processing), or a long paint and layout step after it (presentation delay). Note which, because it decides your fix.

Look for the red triangles marking long tasks — anything over 50 ms. Hovering one names the script responsible.

Step 4 — measure it in the field afterwards

Lab profiling proves the mechanism. Only field data proves visitors benefited, because only real visitors interact in unpredictable ways on unpredictable hardware.

How to fix it, by phase

If input delay is the problem

You need to free the main thread at the moment people interact.

Break up long tasks and yield. Instead of one 300 ms loop, process in chunks and hand control back to the browser between them, so a tap can be handled in the gaps.

// A long task: nothing can interrupt this, including a tap.
for (const item of items) process(item);

// Yielding: the browser gets a chance to handle input between chunks.
async function run(items) {
  for (let i = 0; i < items.length; i++) {
    process(items[i]);
    // Every 50 items, give the browser a turn.
    if (i % 50 === 0) await new Promise((resolve) => setTimeout(resolve, 0));
  }
}

Delay work that is not needed yet. Analytics initialisation, recommendation widgets, chat loading — none of it has to happen while the page is becoming usable. Defer it until the page is idle, or until the visitor interacts with that feature.

Cut third-party execution. This is often the biggest single win, and it is a decision rather than a code change: which scripts earn the main-thread time they take.

Load less code up front. Code splitting helps here — not because smaller files download faster, but because less code has to be parsed, compiled and run.

If processing duration is the problem

Do only what is needed before the next paint. Update what the visitor needs to see immediately, then do the rest afterwards.

button.addEventListener('click', () => {
  // Visible feedback first, so the interaction completes fast.
  button.textContent = 'Added';
  cartCount.textContent = String(count + 1);

  // Everything else can wait until after the browser has painted.
  requestAnimationFrame(() => {
    setTimeout(() => {
      syncCartWithServer();
      trackAddToCart();
      refreshRecommendations();
    }, 0);
  });
});

Avoid layout thrashing. Reading a layout property such as offsetHeight right after writing a style forces the browser to recalculate layout immediately. Doing it in a loop is catastrophic. Batch all reads, then all writes.

Move heavy computation off the main thread with a Web Worker, if the work is genuinely large and does not touch the DOM.

If presentation delay is the problem

Reduce DOM size. A page with thousands of elements costs more to lay out and paint on every change. Collection pages rendering hundreds of products are the usual offender; consider pagination or virtualising long lists.

Limit how much the change affects. A style change scoped to one element is cheap. One that changes the size of a container forces the browser to re-lay-out everything below it.

Use content-visibility so the browser can skip rendering work for sections far below the viewport.

Platform differences

Shopify. Your theme's JavaScript is yours to fix; app scripts are not. In practice INP work on Shopify is mostly app triage: measure what each app costs in main-thread time, remove the ones that do not earn it, and stop the rest loading on templates that do not use them. Variant pickers and filter widgets in the theme are the other common source.

WordPress and WooCommerce. Plugins enqueue scripts site-wide by default, so a page frequently runs code for features it does not have. Dequeuing per template is usually the biggest INP win available. WooCommerce cart fragment requests are a classic cause of unresponsiveness.

Custom and headless builds. Hydration is the usual culprit: the page looks finished but the framework is still attaching behaviour, so early taps are ignored. Reduce how much needs hydrating, hydrate what the visitor can reach first, and prefer server-rendered interactivity where possible.

Hosted builders (Wix, Squarespace). You cannot change the platform's own JavaScript. Your levers are how many apps, widgets and animations you add, and how much sits on the page at once.

Common mistakes

Minifying and compressing to fix INP. Both reduce download size. Neither reduces execution time, which is what INP measures.

Optimising the interaction you assumed was slow. Profile first. The slow one is usually a surprise.

Testing on a fast machine without CPU throttling. You will not reproduce what your visitors experience, and may conclude there is nothing to fix.

Deferring a script that the interaction depends on, so the first tap now does nothing at all. Faster and broken is worse than slow.

Chasing the Lighthouse performance score. Total Blocking Time is a lab proxy and correlates with INP, but it is not INP. Field data is the assessment.

Removing an interaction to improve the metric. The next worst interaction simply takes its place, and the page is less useful.

Verification

  1. Re-profile under the same CPU throttling and confirm the phase you targeted has shrunk. If input delay was your problem, the long task before the handler should be gone or broken up.
  2. Check the interaction still works. The most common INP regression is a handler that is now fast because it no longer does something it needed to do. Test the whole flow, including the slow-network case.
  3. Check your other interactions. Deferring work can move it into a different interaction and make that one the new worst.
  4. Check LCP and CLS. Deferred work that inserts content later can cause layout shift.
  5. Wait for field data. CrUX reports over a rolling 28-day window, so expect movement after about a week and settling after four.

When it still does not improve

  • Input delay is still large — something else is occupying the thread. Look earlier in the recording: the task may belong to a script that loads before yours.
  • Lab is fine, field is poor — your hardware is kinder than your visitors'. Throttle harder, and segment field data by device and country. A single slow device class can fail the metric on its own.
  • One interaction improved but INP did not — INP tracks the worst interaction. You fixed a slow one; there is another.
  • It got worse after code splitting — splitting adds requests and sometimes moves execution to exactly the wrong moment. Measure, do not assume.
  • A third-party script is the cause and you cannot change it — then the decision is commercial, not technical: does the feature justify the responsiveness cost? Measure it so the decision is informed.

Keeping INP good

INP degrades quietly, because the things that damage it — a new app, a new tag, a new widget, a larger catalogue — arrive from outside engineering and never show up in a page-weight check.

What keeps it good: real-user monitoring so you see it change, a check on interaction latency before release rather than after a complaint, and a rule that any new third-party script has its main-thread cost measured before it goes live.

Frequently asked questions

What is a good INP score?

200 milliseconds or less for at least 75% of visits. Between 200 and 500 ms needs improvement, and over 500 ms is poor. INP reflects close to your worst interaction on the page, not the average.

Why is my INP bad when my page loads quickly?

They measure different things. Loading speed is about how fast content appears; INP is about whether the browser can respond while JavaScript is running. A page can render instantly and then ignore taps for half a second because the main thread is busy.

Will reducing my JavaScript bundle size fix INP?

Not reliably. INP is about how long your code runs, not how many bytes it is. A small script that blocks the main thread for 400 ms is far worse than a large one that never blocks it. What helps is breaking up long tasks, yielding to the browser, and running less code during interactions.

What replaced First Input Delay?

INP replaced FID as a Core Web Vital in 2024. FID measured only the delay before the first interaction began processing, so a page could score perfectly while every click took a second to produce a result. INP measures the full interaction, for interactions throughout the visit.

How do I find which interaction is slow?

Open DevTools, go to the Performance panel, set CPU to 4x slowdown, record while using the page the way a visitor would, then look at the Interactions track. Click the longest bar to see its three phases and what was running on the main thread at the time.

Why is INP so much worse on mobile?

Mid-range phones run JavaScript several times slower than a desktop and throttle further as they heat up. The same handler that takes 60 ms on your machine can take 300 ms on a visitor’s phone. Always test with CPU throttling, and ideally on a real mid-range device.

References