---
title: "Interaction to Next Paint (INP): measuring and fixing slow interactions"
description: "Understand what Interaction to Next Paint measures, how to find your slowest interactions in the field, and how to fix them by breaking up long tasks and yielding."
url: https://www.danny.engineering/article/interaction-to-next-paint-inp-measuring-and-fixing-slow-interactions
author: Danny
published: 2026-11-27T00:00:00.000Z
updated: 2026-11-27T17:23:00.000Z
tags: ["Performance"]
---

# Interaction to Next Paint (INP): measuring and fixing slow interactions

You click a button and nothing happens. Half a second later the page catches up. Nothing is broken, but the site feels slow and clumsy. That gap between doing something and seeing the result is what Interaction to Next Paint (INP) measures.


INP is one of the three Core Web Vitals, alongside Largest Contentful Paint and Cumulative Layout Shift. It replaced First Input Delay in March 2024. Where FID only measured the delay before the first interaction's handlers started, INP looks at every click, tap and key press during a visit and reports one of the slowest. It is a much better match for how responsive a page actually feels, and it is much harder to pass.


This article is for front-end developers who have a poor or borderline INP score and want to know where the time goes and how to get it back. We cover what INP measures, how to collect useful data from real users, and the techniques that fix most problems.


## What INP measures


An interaction is a click, a tap or a key press. Scrolling and hovering do not count. For each interaction, the browser measures the time from the user's input until the next frame is painted on screen. INP then reports a value close to the worst interaction on the page. On pages with lots of interactions, it ignores one outlier for every 50 interactions, so one freak slow click on a busy page does not dominate the score.


The thresholds, measured at the 75th percentile of page visits, are:

- **Good:** 200 milliseconds or less
- **Needs improvement:** between 200 and 500 milliseconds
- **Poor:** over 500 milliseconds

### The three parts of an interaction


Every interaction's latency splits into three phases, and knowing which phase is slow tells you what to fix.

1. **Input delay.** The time from the input until event handlers start running. This is long when the main thread is busy with something else, such as a script still loading or a timer firing, at the moment the user acts.
2. **Processing duration.** The time your event handlers take to run. This is long when the handler itself does too much work.
3. **Presentation delay.** The time from the handlers finishing until the browser paints the next frame. This is long when the handler triggers expensive style, layout or paint work, such as re-rendering a huge DOM.

A slow INP is almost always caused by one of these, and they need different fixes.


## Measuring INP in the field


INP is a field metric. It depends on what real users click, on their devices, at the moment they click. Lab tools are useful for debugging, but your real score comes from real users.


### Check what Google sees


If your site has enough traffic, the Chrome UX Report (CrUX) has INP data for it. PageSpeed Insights shows it at the top of the report for any URL or origin, and Search Console has a Core Web Vitals report that groups pages by status. These tell you whether you have a problem, but not which interaction causes it.


### Collect your own data with web-vitals


To find the cause, collect INP from your own users with the `web-vitals` library. Its attribution build adds details about the slowest interaction.


```bash
npm install web-vitals
```


```javascript
import { onINP } from 'web-vitals/attribution';

onINP(({ value, rating, attribution }) => {
  const {
    interactionTarget,
    interactionType,
    inputDelay,
    processingDuration,
    presentationDelay,
  } = attribution;

  navigator.sendBeacon('/analytics/inp', JSON.stringify({
    value,
    rating,
    target: interactionTarget,
    type: interactionType,
    inputDelay,
    processingDuration,
    presentationDelay,
    page: location.pathname,
  }));
});
```


`interactionTarget` is a CSS selector for the element the user interacted with, so after a few days you can group by page and target and see exactly which button, link or input is slow, and which phase is to blame. The attribution object also includes `longAnimationFrameEntries`, which can point to the scripts that were running.


### Reproduce it in DevTools


Once you know the slow interaction, reproduce it locally. Chrome DevTools' Performance panel shows a live INP value as you click around, and lists each interaction. Record a trace while performing the interaction and look at the Interactions track: the bar is split into input delay, processing and presentation delay, and the Main track below shows what ran during each.


Turn on CPU throttling (4x or 6x slowdown) while testing. Your development machine is probably much faster than your users' phones, and many INP problems only show up on slower hardware.


## Understanding long tasks


The browser's main thread runs one task at a time. Rendering a frame cannot happen in the middle of a task. So if a click handler runs for 300 milliseconds, the user waits at least 300 milliseconds to see anything change, and any input that arrives during that time waits too.


A task longer than 50 milliseconds is called a long task. Long tasks are the root cause of most poor INP scores:

- A long task running when the user clicks causes **input delay**.
- A long task inside your handler causes long **processing duration**.
- Heavy rendering work after your handler adds **presentation delay**.

The fix in nearly every case is to do less work on the main thread, or to split it into smaller tasks so the browser can paint and respond in between.


## Fix 1: show feedback first, then do the work


The user does not need the whole job done before they see a response. They need to see that something happened. Update the UI first, let the browser paint, then continue with the rest.


```javascript
button.addEventListener('click', async () => {
  // Cheap, visible feedback
  button.disabled = true;
  status.textContent = 'Saving...';

  // Let the browser paint before carrying on
  await yieldToMain();

  // The expensive part
  const data = serialiseLargeForm(form);
  updateSearchIndex(data);
  sendAnalytics('save');
});
```


INP measures until the next paint. If that paint shows the "Saving..." message, the interaction counts as fast, even though more work follows.


## Fix 2: yield to the main thread


The `yieldToMain()` function above is the key tool. It ends the current task and continues in a new one, giving the browser a chance to paint and handle input in between.


The modern way is `scheduler.yield()`. It is designed for exactly this: the code after the yield continues ahead of other queued tasks, so your work is not pushed to the back of the queue behind every timer and third-party script. It is not available everywhere yet, so use a fallback:


```javascript
function yieldToMain() {
  if (globalThis.scheduler?.yield) {
    return scheduler.yield();
  }
  return new Promise((resolve) => setTimeout(resolve, 0));
}
```


The `setTimeout` fallback works, but the continuation goes to the back of the task queue, so other work can jump in front of it.


### Breaking up a loop


When you have a long list of work items, yield every so often rather than after every item. Yielding has a small cost of its own, so yielding based on elapsed time works well:


```javascript
async function processItems(items) {
  let lastYield = performance.now();

  for (const item of items) {
    processItem(item);

    // Yield roughly every 50ms
    if (performance.now() - lastYield > 50) {
      await yieldToMain();
      lastYield = performance.now();
    }
  }
}
```


This keeps each task under the long-task threshold while still getting through the list quickly.


## Fix 3: defer work that is not urgent


A lot of code in click handlers does not need to run before the next frame: analytics calls, saving to local storage, prefetching, logging. Move it out of the way.


```javascript
menuButton.addEventListener('click', () => {
  menu.classList.toggle('open');

  // Run after the next paint
  requestAnimationFrame(() => {
    setTimeout(() => {
      trackEvent('menu_toggle');
      localStorage.setItem('menu-open', menu.classList.contains('open'));
    }, 0);
  });
});
```


The `requestAnimationFrame` plus `setTimeout` pair waits until the frame has been produced and then runs in a new task. For truly background work, `requestIdleCallback` is another option, though it can be delayed for a long time on a busy page.


## Fix 4: reduce input delay from other scripts


If the slow phase is input delay, the problem is not your handler; it is whatever was running when the user clicked. Common culprits are:

- Large JavaScript bundles being parsed and executed during page load. Split them and load less up front.
- Third-party tags such as analytics, ads and chat widgets. Audit them, load them later, or remove the ones you do not need.
- Timers and polling that do heavy work on an interval.
- Hydration in server-rendered frameworks, which can block the main thread for a long time on large pages.

The Long Animation Frames API (and the `longAnimationFrameEntries` in the web-vitals attribution) shows which scripts were running during slow frames, including third-party ones, which makes this much easier to track down.


## Fix 5: cut presentation delay


If handlers are quick but presentation delay is large, the browser is struggling to render the result. Typical causes:

- **A very large DOM.** Thousands of elements make every style and layout change expensive. Virtualise long lists, paginate, or use `content-visibility: auto` on off-screen sections so the browser can skip rendering them.
- **Layout thrashing.** Reading a layout value such as `offsetHeight` straight after changing styles forces the browser to calculate layout immediately. Do all your reads first, then all your writes.
- **Re-rendering too much.** In React and similar frameworks, a state change high up the tree can re-render large parts of the page. Move state closer to where it is used, memoise expensive children, or mark non-urgent updates with `startTransition` so React can keep the UI responsive.

```javascript
import { startTransition, useState } from 'react';

function Search({ allItems }) {
  const [query, setQuery] = useState('');
  const [results, setResults] = useState(allItems);

  function handleChange(event) {
    const value = event.target.value;
    setQuery(value); // urgent: update the input
    startTransition(() => {
      setResults(filterItems(allItems, value)); // can wait
    });
  }

  return (
    <>
      <input value={query} onChange={handleChange} />
      <ResultsList items={results} />
    </>
  );
}
```


## Browser support


INP is built on the Event Timing API. Chrome and Edge have supported it for years, and Firefox and Safari 26.2 added support, which made INP Baseline newly available in December 2025. You can now collect INP from users on all major browsers. Early reports suggest Safari's numbers can differ from Chrome's for some interactions, so compare browsers separately rather than mixing them in one chart.


Google's CrUX data, which feeds PageSpeed Insights and Search Console, still comes only from Chrome users.


`scheduler.yield()` is supported in Chrome and Edge 129 and later and in Firefox 142 and later. Safari does not support it at the time of writing, which is why the fallback above matters.


## When not to use these techniques

- **Do not yield in the middle of work that must be atomic.** If your code reads and writes shared state, yielding lets other code run in between and see a half-finished state. Finish the critical part first, then yield.
- **Do not move work off the main thread if the next frame depends on it.** If the user needs to see the result straight away, deferring it just moves the delay.
- **Do not chase lab scores alone.** A good Lighthouse result does not mean a good INP, because Lighthouse's default navigation mode does not interact with the page. Use field data to decide what to fix.
- **Do not add a scheduler library before measuring.** Most INP problems come from a few specific handlers or third-party scripts. Find those first.

## Wrapping up

- INP measures the time from a click, tap or key press to the next paint, and reports close to the slowest interaction; aim for 200 milliseconds or less at the 75th percentile.
- Split each slow interaction into input delay, processing duration and presentation delay; each has a different fix.
- Use the `web-vitals` attribution build to find the slow element and phase from real users, then reproduce it in DevTools with CPU throttling.
- Show feedback first, yield with `scheduler.yield()` and a `setTimeout` fallback, and defer work that is not needed for the next frame.
- Reduce input delay by loading less JavaScript up front, and cut presentation delay with a smaller DOM and fewer re-renders.

Further reading: [web.dev: Interaction to Next Paint](https://web.dev/articles/inp)
