The menu button is pressed, nothing happens for half a second, and the user presses it again. Interaction to Next Paint (INP) measures exactly this time: the time from a click, tap or keyboard interaction until the next frame is painted on screen. It replaced FID in Core Web Vitals in March 2024; at the 75th percentile, 200 ms or less is considered “good” and over 500 ms “poor”. This guide describes the order we follow on a page with poor INP, from finding the problem interaction to verifying the fix; a general introduction to the metrics is in the speed-up guide.
The three components of INP
The duration of an interaction is split into three parts, and each part has a different solution. The first job in diagnosis is to find which part the problem is in. Optimization done without knowing the part is a shot in the dark.
| Component | What it measures | Typical cause |
|---|---|---|
| Input delay | From the interaction until the event handler starts | Another long task running at that moment (script loading, timers) |
| Processing duration | The run time of the event handlers | Heavy handler code, synchronous computation, multiple listeners |
| Presentation delay | From when handlers finish until the frame is painted | Large DOM, style and layout cost, forced synchronous layout |
Any task on the main thread that exceeds 50 ms counts as a “long task”. A long task isn’t INP on its own; but if the user interacts at exactly that moment it turns into input delay, and if the handler itself takes long it turns into processing duration.
Finding the problem interaction in field data
The Core Web Vitals report in Search Console and the CrUX data in PageSpeed Insights show which URL groups have INP problems, but they don’t say which element the slow interaction was with. For that you need your own measurement. The attribution build of Google’s web-vitals library gives the interaction target and the durations of the three components for each INP value:
import { onINP } from 'web-vitals/attribution';
onINP(({ value, rating, attribution }) => {
const data = {
inp: Math.round(value),
rating: rating, // good | needs-improvement | poor
target: attribution.interactionTarget, // e.g. "button.menu-toggle"
type: attribution.interactionType, // pointer | keyboard
inputDelay: Math.round(attribution.inputDelay),
processing: Math.round(attribution.processingDuration),
presentation: Math.round(attribution.presentationDelay),
loadState: attribution.loadState, // page load state at the moment of interaction
page: location.pathname
};
navigator.sendBeacon('/rum', JSON.stringify(data));
});
The field names above follow the naming introduced in version 4 of the library; in version 3 the target field had a different name, and fields may change in later versions too. Check the documentation for the version you use. Group the collected data by target selector and page template. The picture in the field is usually the same: most of the INP problem comes from a few components — the menu button, a filter, an accordion, the cookie banner button. The loadState field separates whether the problem occurred while the page was loading or after loading finished. Delays during loading usually come from script load, those afterwards from handler code.
The data sent shouldn’t contain personal data; the selector and URL path are enough for diagnosis. If you use the same data model as your web analytics and conversion measurement work for the transfer to your analytics infrastructure and the event design, reporting runs from a single place.
Profiling the interaction with DevTools
Reproduce the interaction found in the field in the lab. Developer machines are much faster than the mid-range mobile devices in the field; measuring without CPU throttling hides the problem. Throttling is a must at this step.
- Open the Performance panel in Chrome DevTools and choose CPU throttling (e.g. 4x or 6x).
- Start recording, perform the interaction that looks problematic in the field, and stop recording.
- Find the interaction in the Interactions track; when you hover over it, input delay, processing duration and presentation delay are shown separately.
- Examine the tasks in the same time range in the Main track. Tasks marked with a red triangle in the top-right corner are long tasks. The Bottom-Up view below lists the functions and files that took the most time.
- Purple “Recalculate Style” and “Layout” blocks point to presentation delay; yellow script blocks to processing duration.
The Performance panel’s live metrics view shows the local INP value and the list of interactions as you interact with the page, without recording; it’s handy for a quick scan. To see which script is causing the delay in the field, the Long Animation Frames API (long-animation-frame entries) reports the script source and duration. From version 4 of web-vitals, the attribution output carries these entries in the longAnimationFrameEntries field. The culprit shows up by file name.
Breaking up long tasks
If an event handler does both the screen update and the heavy work in the same task, the most effective fix is to split the work in two: first give the user visual feedback, then release the main thread and do the remaining work in subsequent tasks.
function yieldToMainThread() {
if (globalThis.scheduler?.yield) {
return scheduler.yield();
}
return new Promise(resolve => setTimeout(resolve, 0));
}
filterButton.addEventListener('click', async () => {
// 1. Immediate visual feedback
filterButton.setAttribute('aria-pressed', 'true');
resultArea.classList.add('loading');
// 2. Let the browser paint the frame
await yieldToMainThread();
// 3. Heavy work: filtering and re-rendering
const result = filterProducts(allProducts, selectedFilters);
updateList(result);
// 4. Non-urgent work: analytics event
await yieldToMainThread();
sendAnalyticsEvent('filter_applied');
});
scheduler.yield() is available in Chromium-based browsers; check the support status in other browsers in the MDN compatibility table. In browsers that don’t support it, the setTimeout fallback serves the same purpose but doesn’t preserve the priority of the continuing work. When processing a large array, instead of yielding after every item, yield when a set time (e.g. 50 ms) has elapsed; this avoids unnecessary context switching.
Event handlers and rendering cost
The causes of processing duration and presentation delay we see most often in the field, and their fixes:
- Many listeners attached to the same event: The theme, page builder, Tag Manager click triggers and plugins can each add a separate listener to the same click. See the listeners attached to an element in the Event Listeners tab of the DevTools Elements panel, and remove the unnecessary ones.
- Forced synchronous layout (layout thrashing): Changing a style in a loop and immediately reading
offsetHeightorgetBoundingClientRect()forces the browser to calculate layout at every step. Do all the reads first, then all the writes. - Frequently fired events: Instead of doing heavy work on
inputorresizeevents, debounce the work or run it once per frame withrequestAnimationFrame. - Large DOM: Hidden mega menu content, nested wrappers and long lists increase style and layout cost. For large off-screen sections, CSS
content-visibility: auto(together withcontain-intrinsic-size) defers rendering work until they become visible. - Large HTML injection on interaction: If the content of an opening menu or modal is rebuilt with
innerHTMLevery time, building the content once and toggling its visibility is cheaper.
On sites built with a page builder, the last two items often come together. The mega menu is output into the DOM on every page, stays hidden, but costs something in every style calculation.
If input delay dominates, the problem is usually another script running at the moment of interaction: analytics, chat or ad scripts running while the page loads. In that case the solution is to manage the total script load and loading timing; the topic is covered separately in the JavaScript budget and third-party scripts guide.
Verifying the fix
Verification is done at three levels, and each level has a different lag:
| Layer | Method | Feedback time |
|---|---|---|
| Lab | Re-recording the same interaction with the same CPU throttling | Instant |
| Your own RUM measurement | Comparing the INP distribution by target selector before/after | A few days (depending on traffic) |
| CrUX / Search Console | A change in URL group status | 28-day rolling window |
Don’t rely on a single recording in the lab. Repeat the same interaction several times and note the median. In the RUM data, mark the release date of the fix and monitor the 75th percentile by page group. If the release date isn’t marked, nobody can say two weeks later why the improvement came. For a permanent monitoring setup, the guide to monitoring Core Web Vitals with CrUX and RUM proposes a detailed structure.
Checklist before closing:
- The target of the problem interaction and its dominant component (input, processing, presentation) have been identified.
- The interaction has been reproduced in a lab environment with CPU throttling.
- Visual feedback is given before the heavy work, and non-urgent work is deferred.
- Unnecessary listeners and forced synchronous layout have been removed.
- RUM and CrUX values are being monitored after the change.
To handle INP diagnosis and fixes systematically across the templates of your corporate site, see our web performance and Core Web Vitals service. For the official definition of the metric, refer to the web.dev INP documentation.
Frequently asked questions
Does Lighthouse measure INP?
The standard Lighthouse page load audit doesn’t include user interaction, so it doesn’t measure INP; Total Blocking Time (TBT), which shows main thread load, is only an approximate indicator. INP requires field data (CrUX or your own RUM measurement) or a recording of a real interaction in the DevTools Performance panel. Lighthouse’s timespan mode can report INP from recorded interactions.
When will improvement show in Search Console after a fix?
CrUX data is calculated over a rolling window of the last 28 days. The effect of a change is reflected gradually in field data, and the full effect is seen after about four weeks. For faster feedback, set up your own RUM measurement with the web-vitals library.
What’s the difference between setTimeout and scheduler.yield?
Both release the main thread and let the browser handle pending input and rendering work. A continuation deferred with setTimeout is added to the end of the task queue and can end up behind other scripts’ tasks. Work released with scheduler.yield continues with its priority preserved; add a setTimeout fallback for browsers that don’t support it.
Why does DOM size affect INP?
A DOM change made after an interaction triggers style recalculation and layout work; the cost of this work grows with the number of elements affected. On a page made up of thousands of elements, even a small class change can lengthen presentation delay. The main sources are hidden mega menu content, the nested wrappers of page builders and long lists.