How to fix INP and make slow interactions respond faster
INP is poor when JavaScript blocks the main thread as someone taps. Find the slow interaction, see which phase is slow, and cut scripts or split the work.
By Sohail Hussain21 November 20265 min read
Interaction to Next Paint (INP) is poor when the browser's main thread is busy at the moment someone taps, clicks or types, or when the code that handles the interaction takes too long. To fix it, find which interaction is slow in real-user data, see which of its three phases takes the time (input delay, processing, or presentation), and then cut the JavaScript responsible or split it into smaller pieces. Good INP is 200 milliseconds or less at the 75th percentile of visits; over 500 milliseconds is poor.
INP is usually the hardest of the three Core Web Vitals to fix, because the cause is spread across your own code, your framework and every third-party script on the page. The approach below follows Google's guide to optimising INP.
Why is INP poor?
The browser runs JavaScript, handles input, calculates layout and paints, all on one main thread. While a script runs, a tap has to wait. INP measures the full time from the interaction to the next frame on screen, in three phases:
| Phase | What happens | Common causes | Typical fixes |
|---|---|---|---|
| Input delay | The tap waits for the main thread to be free | Third-party scripts, hydration, other long tasks | Remove or delay scripts, ship less JavaScript |
| Processing | Your event handlers run | Heavy handlers, large state updates, synchronous tracking calls | Do the visible update first, defer the rest |
| Presentation delay | Layout, style and paint after the handlers | Very large DOM, big re-renders, forced layout | Smaller DOM, fewer elements updated, content-visibility |
The page's INP is its slowest interaction, ignoring a few outliers on pages with many. So one slow menu, filter or "Add to cart" button can fail a page where everything else is instant.
If you would rather hand this over, diagnosing and fixing INP is part of our technical SEO and performance work.
How do you find the slow interaction?
Field data first. Search Console's Core Web Vitals report and the top of PageSpeed Insights show whether INP fails and on which group of pages. Lab tools cannot measure it, because a standard Lighthouse run never interacts with the page; its Total Blocking Time is only a rough proxy for input delay. Note your current figure in our Core Web Vitals checker.
Then find the element. Field data tells you a page is slow, not which button. The web-vitals library's attribution build reports both the element and the phase breakdown from real visitors:
import { onINP } from "web-vitals/attribution";
onINP(({ value, attribution }) => {
const { interactionTarget, inputDelay, processingDuration, presentationDelay } = attribution;
// Send these to your analytics instead of logging them
console.log(value, interactionTarget, inputDelay, processingDuration, presentationDelay);
});
Reproduce it in DevTools. Open the Performance panel in Chrome, set CPU throttling to 4x or 6x slowdown to approximate a mid-range phone, start recording, and use the page: open the menu, type in the search box, press the main buttons. The panel shows each interaction with its duration and the long tasks around it. The live metrics view in the same panel shows INP as you click, without a recording.
How do you reduce input delay?
Input delay is time spent waiting for other work to finish. On business sites, most of that other work is scripts the visitor never asked for.
- Audit third-party tags. List every script on the page: tag manager, analytics, chat, heatmaps, A/B testing, ad pixels. Remove the ones nobody uses. A tag manager that loads fifteen tags is fifteen scripts competing with the visitor's tap.
- Load the rest later. In Next.js,
next/scriptwithstrategy="lazyOnload"waits until the browser is idle. A chat widget can load when the visitor clicks a placeholder button rather than on page load. - Ship less of your own JavaScript. Every client component has to be downloaded, parsed and hydrated, and hydration happens exactly when visitors start tapping. In the Next.js App Router, keep content in server components and use
"use client"only for the interactive parts. Server components explained covers why this matters. - Split large bundles. Load heavy, rarely used components, such as a chart or a rich text editor, with
next/dynamicorimport()when they are needed.
How do you speed up event handlers?
Processing time is the work your code does in response to the interaction. The principle: show the visible result first, and do everything else after the browser has painted.
function yieldToMain() {
if (globalThis.scheduler?.yield) return globalThis.scheduler.yield();
return new Promise((resolve) => setTimeout(resolve, 0));
}
async function handleAddToCart(button) {
button.textContent = "Added"; // visible feedback first
await yieldToMain(); // let the browser paint
sendAnalyticsEvent("add_to_cart");
syncCartWithServer();
}
scheduler.yield() hands control back to the browser and resumes your function as soon as it can, ahead of other queued work. Browsers that lack it fall back to setTimeout. The same pattern breaks any long loop into chunks.
In React, mark expensive updates as non-urgent so typing and clicks stay responsive:
"use client";
import { useDeferredValue, useState } from "react";
import { ProductList } from "./product-list";
export function ProductSearch() {
const [query, setQuery] = useState("");
const deferredQuery = useDeferredValue(query);
return (
<>
<input value={query} onChange={(e) => setQuery(e.target.value)} />
<ProductList query={deferredQuery} />
</>
);
}
The input updates immediately, and the list re-renders with the deferred value in the background, where React can interrupt it. This only helps if ProductList skips re-rendering when its props have not changed: wrap it in memo, or enable the React Compiler, which Next.js 16 supports as a stable option and which adds that memoisation automatically. startTransition does the same job when you control the state update rather than the value.
Also check for handlers that read layout right after changing it, such as setting a class and then reading offsetHeight. That forces the browser to calculate layout in the middle of your code. Batch the reads before the writes.
How do you cut presentation delay?
After the handlers finish, the browser recalculates styles and layout and paints the frame. That gets slow when there is a lot to recalculate.
- Keep the DOM small. Pages with many thousands of elements, often from page builders or mega-menus rendered in full on every page, are slow to update. Render menus and long lists only when opened or scrolled into view.
- Use
content-visibility: autoon long, off-screen sections so the browser skips their layout until they are near the viewport. - Update less. A state change at the top of a React tree re-renders everything below it. Keep state close to where it is used, so a click re-renders a button, not the page.
How do you confirm the fix?
Repeat the DevTools recording with the same throttling and check each interaction is under 200 milliseconds. Then deploy and watch the field data, which is a 28-day rolling window, so the full effect takes about four weeks to show. Real-user monitoring through useReportWebVitals in Next.js, or a host feature such as Vercel Speed Insights, shows the change sooner and per page.
INP rewards pages that ship little JavaScript in the first place, which is the main argument in why we build company websites with Next.js. For the other two metrics, see how to fix a poor LCP score and how to fix layout shift, and Core Web Vitals explained for how the three fit together.
Was this guide useful?