Core Web Vitals: INP Optimization Techniques
In March 2024, Google officially replaced First Input Delay (FID) with Interaction to Next Paint (INP) as a Core Web Vital. Unlike FID, which only measured the initial delay of the very first click on a page, INP measures the entire lifespan of every single interaction (clicks, taps, and key presses) throughout the user's session.
If your website feels sluggish, unresponsive, or visually freezes when a user clicks a button, your INP is failing. Because Core Web Vitals are a direct ranking factor, a failing INP will drag down your organic search performance.
To achieve a "Good" INP score, your 75th percentile of interactions must resolve in under 200 milliseconds.
1. The Anatomy of an INP Failure
An interaction consists of three distinct phases. Identifying which phase is bottlenecking your site is the key to optimization:
- Input Delay: The time between the user clicking and your event handler actually starting to run. Usually caused by a background script monopolizing the main thread.
- Processing Time: The time it takes for your JavaScript event handlers to execute their logic.
- Presentation Delay: The time it takes the browser to calculate layout, paint the new pixels, and render the visual update to the screen.
2. Phase 1: Defeating Input Delay (Long Tasks)
The main thread is single-lane traffic. If a heavy background script (like a third-party analytics tag or a massive React hydration payload) is executing, the browser cannot respond to a user's click until that script finishes.
Any JavaScript task exceeding 50ms is classified as a "Long Task."
The Solution: Yielding to the Main Thread You must break up Long Tasks. Instead of running a massive calculation in one go, you must explicitly tell the browser to pause, check if the user is trying to click something, and then resume.
- Legacy Method:
setTimeout(() => { ... }, 0) - Modern API: Use the
scheduler.yield()API (orrequestIdleCallbackfor non-critical tasks) to safely pause execution.
3. Phase 2: Optimizing Processing Time (React/Vue)
If your Javascript event handler takes 300ms to calculate new state, your INP is already failing before the browser even tries to paint.
Framework Optimizations: In modern frameworks like React 18+, not all state updates are equal. If a user clicks a filter button, updating the button state (e.g., turning it blue) must happen instantly. Fetching and rendering the 500 new products can be slightly delayed.
- Use React's
useTransitionorstartTransitionto explicitly tell React: "Render the button state immediately, but treat the heavy product grid update as non-urgent." This keeps the interface feeling highly responsive, rescuing your INP score.
4. Phase 3: Eliminating Presentation Delay
Sometimes, your JavaScript is perfectly optimized, but the browser takes 400ms just to draw the changes.
DOM Size and Layout Thrashing: A massive DOM (thousands of hidden HTML nodes) forces the browser to recalculate the style of the entire page whenever you change a single class name.
- Solution: Use the CSS property
content-visibility: autoon off-screen sections (like heavy footers or deep accordion content). This instructs the browser to skip rendering calculations for those elements until they are scrolled into view. - Avoid "Layout Thrashing" (reading a DOM property, altering it, and reading it again in a tight loop), which forces the browser into expensive synchronous layout recalculations.
5. Essential Tools for INP Debugging
You cannot optimize what you cannot measure.
| Tool | Phase | Enterprise Use Case |
| :--- | :--- | :--- |
| PageSpeed Insights / CrUX | Field Data | Use this to see the actual 75th percentile score affecting your SEO. |
| Real User Monitoring (RUM) | Discovery | Tools like Sentry, Datadog, or DebugBear are mandatory. They pinpoint exactly which HTML element (e.g., #add-to-cart-btn) caused the highest INP in the field. |
| Chrome DevTools (Performance Tab) | Lab Debugging | Once you know the problematic button via RUM, use the Performance Flame Chart locally to dissect the exact Long Tasks blocking the interaction. |
Frequently Asked Questions
What is Interaction to Next Paint (INP)?
INP is a Core Web Vital that measures the overall responsiveness of a webpage. It replaced First Input Delay (FID) in March 2024. INP assesses the latency of all interactions (clicks, taps, key presses) throughout a user's entire visit, taking the longest interaction as the final score.
How do I measure INP accurately?
Because INP requires a user to actually click or interact with the page, it cannot be perfectly simulated in a lab environment (like Lighthouse). You must rely on Field Data via Chrome User Experience Report (CrUX) or Real User Monitoring (RUM) tools to get accurate metrics.
Why is my INP score so high?
High INP (over 200ms) is typically caused by a triad of bottlenecks: heavy JavaScript execution blocking the main thread (Long Tasks), massive DOM sizes that take too long to recalculate (Presentation Delay), and excessive third-party scripts (Input Delay).
How do I fix Presentation Delay in INP?
To reduce the time it takes the browser to paint updates, minimize your total DOM node count. Avoid CSS layout thrashing (synchronous DOM reads/writes), use requestAnimationFrame for complex visual updates, and apply content-visibility: auto to off-screen elements.
What is the difference between INP and FID?
First Input Delay (FID) only measured the "input delay" phase of the very first interaction a user had with a page. INP is a much stricter, more holistic metric that measures the entire duration (Input + Processing + Presentation) of all interactions across the user's session.
Notes and field research directly from the growth strategists and data engineers running B2B and B2C client accounts day to day.
Get one email per month, no spam
We send our latest growth research and technical findings directly to your inbox before publishing anywhere else.