How to reduce INP: practical cases for sites that respond instantly
Of the three Core Web Vitals, INP (Interaction to Next Paint) is the one that fails most often, and the least understood. It measures how long the page takes to respond visually when the user clicks, taps or presses a key. If you press a button and nothing happens for half a second, your INP is bad.
I explain it in depth in Core Web Vitals 2025. Here we go practical: how to find and fix slow interactions.
What it measures exactly
For each interaction, INP adds up three phases:
- Input delay: the browser is busy and takes time to handle the event.
- Processing time: how long your event handlers take.
- Presentation delay: computing the layout and painting the next frame.
The reported value represents, in practice, the worst interaction of the visit (at a high percentile). Google’s thresholds: good ≤ 200 ms, needs improvement up to 500 ms, poor above.
Step 1: measure it with real data
Lab data doesn’t capture INP well because it depends on real interactions.
- Search Console → Core Web Vitals: which URLs fail, with user data.
- PageSpeed Insights: the field data section.
- The
web-vitalslibrary, to measure on your own site with attribution:
import { onINP } from 'web-vitals/attribution';
onINP(({ value, attribution }) => {
console.log('INP:', Math.round(value), 'ms');
console.log('Element:', attribution.interactionTarget);
console.log('Event type:', attribution.interactionType);
// Send this to your analytics to see which interactions fail
});
Attribution tells you which element and which event type cause the worst latency, which is exactly what you need to know where to look.
Step 2: reproduce and diagnose
In Chrome DevTools → Performance: record, perform the slow interaction and look in the main thread for:
- Long tasks (blocks over 50 ms).
- Which function takes the most time (
Bottom-Up). - Whether the cost is in your JavaScript, in styles/layout or in painting.
Case 1: an event handler that does too much
Symptom: pressing “Filter” has a delay; the handler recalculates and paints everything.
Fix: do the minimum to paint the visual response and defer the rest.
button.addEventListener('click', async () => {
button.classList.add('loading'); // immediate visual feedback
await yieldToMain(); // let the browser paint
const result = computeHeavyFilter(); // expensive work afterwards
render(result);
});
function yieldToMain() {
if (globalThis.scheduler?.yield) return scheduler.yield();
return new Promise((r) => setTimeout(r, 0)); // fallback
}
scheduler.yield() hands control back to the browser and lets you continue afterwards with priority; it isn’t available in every browser, hence the setTimeout fallback.
Case 2: a long task blocking the thread
Symptom: processing a huge list freezes the page.
Fix: split the work into chunks and yield between them.
async function processInBatches(items, batchSize = 200) {
for (let i = 0; i < items.length; i += batchSize) {
processBatch(items.slice(i, i + batchSize));
await yieldToMain();
}
}
For truly heavy computation, move the work to a Web Worker.
Case 3: third-party scripts
Analytics, chats, marketing pixels, widgets… They are often the main culprits on the main thread.
- Audit which ones you load and remove those that add nothing.
- Load them late (after interaction or when the browser is idle).
- Avoid loading many at once at startup.
Case 4: too much DOM and costly re-renders
Pages with thousands of nodes make every update more expensive.
- Reduce DOM size; virtualise long lists.
- Use
content-visibility: autoon off-screen sections to save rendering work:
.long-section {
content-visibility: auto;
contain-intrinsic-size: auto 800px; /* reserve estimated space */
}
- In frameworks (Vue, React), avoid re-rendering components that don’t change and don’t put unnecessary global state.
Case 5: heavy hydration
A framework that hydrates the whole page on load blocks the thread just when the user starts interacting.
- Hydrate only what is interactive and lazily (the islands idea from Astro).
- In Nuxt, use deferred components for what isn’t critical.
Case 6: layout thrashing
Alternating reads and writes of layout properties (offsetHeight, then changing styles, then reading again) forces repeated recalculations. Batch reads first and writes after.
INP checklist
- Measured with field data and attribution.
- Light event handlers; heavy work yielded or moved to a worker.
- No unnecessary long tasks.
- Third-party scripts audited and deferred.
- Contained DOM;
content-visibilityon long sections. - Minimal hydration.
Conclusion
Improving INP is, above all, letting the main thread breathe: do the minimum to give a visual response, yield control often and remove what is unnecessary. Measure with real users, attack the worst interaction first and measure again.
If your site fails Core Web Vitals and you want a performance audit with an action plan, write to me.