How to optimize Interaction to Next Paint for better page experience
guide // , 4 min read, by Darthwares
To optimize Interaction to Next Paint (INP), you must reduce execution delays on the main thread so that user interactions produce a frame update within 200 milliseconds or less. Google documents that Core Web Vitals apply to all web pages, should be measured by site owners, and are surfaced across all Google tools. INP evaluates page responsiveness by measuring the latency of click, tap, and keyboard interactions during a visit. Improving INP ensures that your site provides quick visual feedback to user inputs.
On this page // 5 sections
The short version
- Aim to keep Interaction to Next Paint at 200 milliseconds or less for a good user experience.
- INP measures input delay, processing duration, and presentation delay across all interactions during a page visit.
- Any main thread task taking longer than 50 milliseconds is a long task that delays responsiveness.
- Yielding to the main thread immediately after updating user interface logic allows rendering to take place sooner.
What is Interaction to Next Paint?
Interaction to Next Paint is a metric that assesses overall responsiveness by measuring the time between a user interaction and the presentation of the next frame. MDN Web Docs explains that INP measures the worst latency, minus outliers, for interactions such as clicking a link, tapping a button, or using custom JavaScript controls.
Google documents that INP improves on First Input Delay by observing all interactions throughout the lifespan of a user visit. The final value represents the single longest interaction observed, ignoring extreme outliers. A low score confirms that the page consistently responded quickly to the vast majority of interactions.
What are the three components of INP latency?
Every interaction latency is divided into input delay, processing duration, and presentation delay. web.dev notes that every interaction begins with input delay, which measures the time from when the user taps, clicks, or presses a key until the event callbacks start to run.
Processing duration is the time required for event callbacks to run to completion. Presentation delay is the time it takes for the browser to present the next frame showing the visual update. Reducing latency in all three components ensures that the overall interaction delay stays minimal.
How do you measure and diagnose poor INP?
Diagnosing INP requires measuring both local developer environments and real-world runtime behavior. Google notes that lab measurement is the best way to test performance during development before releasing features to users. Chrome for Developers defines runtime performance as how your page performs while running rather than loading.
Tracking frame rates helps pinpoint user experience drops. The primary metric for animation performance is frames per second, and seeing a red bar above the framerate indicator means performance has dropped enough to harm the user experience. MDN Web Docs notes that the Long Animation Frames API helps identify the specific code responsible for high INP.
- 01Open performance profiling in your browser and turn on CPU Throttling to simulate mobile devices.
- 02Perform clicks, taps, and keypresses on your page components while recording runtime performance.
- 03Inspect the performance profile and the Long Animation Frames API logs for tasks with long processing times or visual delay.
| Symptom | Diagnostic check | Action |
|---|---|---|
| Red bar above FPS indicator | Profile frame rates during runtime actions | Reduce main thread work to prevent dropped frames |
| Long processing duration | Examine execution time of event callbacks | Break up long JavaScript tasks into smaller units |
| High input delay | Inspect main thread activity prior to callback start | Remove recurring timers and avoid interaction overlap |
How do you reduce main thread blocking and task delay?
Most browser work and JavaScript execution occur on the main thread, where tasks over 50 milliseconds count as long tasks. The blocking period is the portion of a task exceeding 50 milliseconds. Breaking up long tasks into smaller chunks prevents the main thread from blocking incoming interactions.
To reduce input delay, avoid recurring timer callbacks and prevent interaction overlap while minimizing main thread work. MDN Web Docs notes that asynchronous operations like network fetches or file reads usually do not delay INP because the browser can paint while handling them.
Yielding main thread control allows rendering logic to execute earlier. web.dev notes that yielding indiscriminately helps, but yielding immediately after an event callback updates the user interface allows the browser to paint the next frame sooner.
Common questions
What is a good Interaction to Next Paint score?
To provide a good user experience, web.dev states that websites should strive to have an Interaction to Next Paint of 200 milliseconds or less.
Why is INP included in Core Web Vitals?
Core Web Vitals represent distinct facets of user experience, are measurable in the field, and reflect real-world outcomes for user experience on all pages.
Do asynchronous fetch calls delay INP?
MDN Web Docs notes that asynchronous operations like network fetches or file reads usually do not delay INP because painting can occur while those operations run.
How does INP differ from FID?
INP evaluates all interactions throughout a page visit, measuring input delay, callback processing duration, and presentation delay until the next frame paints.
Primary sources and further reading
This article was researched and written by an AI model and published automatically. It was written from sentences that were checked to appear on the pages below, but a person has not reviewed the text. If something is wrong, tell us at chibivikramathithan@darthwares.com and we will correct it.