INP: Interaction to Next Paint Explained and How to Fix It

INP: Interaction to Next Paint Explained and How to Fix It

In March 2024, Google replaced First Input Delay (FID) with Interaction to Next Paint (INP) as the responsiveness Core Web Vital. INP is a stricter, more comprehensive measure of how responsive your page feels during the entire user session — not just the first interaction.

If your site passed Core Web Vitals with FID, it may now be failing with INP. This guide explains what changed, how INP is measured, and how to fix the most common causes of poor INP scores.

What Changed: FID vs INP

First Input Delay (FID) measured only the delay before the browser could start processing the first user interaction on a page. It didn't measure how long that processing took, and it ignored all subsequent interactions.

Interaction to Next Paint (INP) measures the worst interaction latency across all interactions during the page visit. For each click, tap, or keyboard press:

  1. The user initiates an interaction
  2. The browser processes it (JavaScript event handlers run)
  3. The browser paints the visual response

INP measures the time from step 1 to step 3. The metric reports the 98th percentile (or worst interaction in sessions with fewer than 50 interactions) over the full page session.

Why this matters: A page can have great FID (fast first interaction) while being sluggish everywhere else. Shopping carts that lag on item add, dashboards that pause when switching tabs, search boxes that delay showing results — FID missed all of these. INP catches them.

INP Thresholds

Score INP Value
Good ≤ 200ms
Needs improvement 200–500ms
Poor > 500ms

For context: users perceive interactions under 100ms as instantaneous. At 300ms, interaction feels sluggish. Above 500ms, it feels broken.

How to Measure INP

Chrome DevTools

The Performance panel shows interaction latency:

  1. Open DevTools → Performance
  2. Click "Record"
  3. Interact with the page (clicks, typing, tab switching)
  4. Stop recording
  5. In the timeline, look for "Interactions" track — each interaction shows as a bar

Hover over any interaction bar to see:

  • Input delay (time waiting for main thread)
  • Processing time (event handlers)
  • Presentation delay (rendering)

web-vitals JavaScript Library

import { onINP } from 'web-vitals';

onINP((metric) => {
    console.log('INP:', metric.value, 'ms');
    console.log('Attribution:', metric.attribution);
    
    // Send to analytics
    fetch('/analytics', {
        method: 'POST',
        body: JSON.stringify({
            name: 'INP',
            value: metric.value,
            rating: metric.rating, // 'good', 'needs-improvement', 'poor'
            attribution: {
                interactionType: metric.attribution.interactionType,
                interactionTime: metric.attribution.interactionTime,
                processingDuration: metric.attribution.processingDurationDuration,
                inputDelay: metric.attribution.inputDelay,
                presentationDelay: metric.attribution.presentationDelay,
                loadState: metric.attribution.loadState
            }
        })
    });
});

The attribution object (added in web-vitals v3) tells you which interaction caused the poor INP and breaks down the three phases.

Field Data

INP is a field metric — it measures real user interactions, not lab simulations. Lab tools like Lighthouse measure Total Blocking Time (TBT) as a proxy, but TBT and INP don't always correlate.

For real INP data:

  • Chrome User Experience Report (CrUX): bigquery-public-data.chrome-ux-report
  • Google Search Console: Core Web Vitals report
  • Your own RUM: implement web-vitals and send to your analytics backend

The Three Components of INP

Every interaction has three phases:

[User input] → [Input delay] → [Processing] → [Presentation delay] → [Paint]
                (waiting for          (JS runs)     (rendering/layout/
                 main thread)                         paint)

1. Input Delay

The browser can't respond to an event handler while the main thread is busy with something else. Long input delays happen when:

  • Long tasks are running (script execution over 50ms)
  • Third-party scripts monopolize the main thread
  • Timers and intervals fire during interaction

Diagnosis: In Chrome DevTools Performance panel, look for long tasks (red triangles) before your interaction.

Fix: Break up long tasks with scheduler.postTask() or setTimeout(fn, 0):

// Before: one long synchronous task
function processItems(items) {
    items.forEach(item => expensiveProcess(item));
}

// After: yield to allow browser to handle interactions
async function processItems(items) {
    for (const item of items) {
        expensiveProcess(item);
        // Yield every 5ms to keep main thread responsive
        if (performance.now() % 5 < 1) {
            await scheduler.yield?.() ?? new Promise(r => setTimeout(r, 0));
        }
    }
}

2. Processing Duration

Your event handler itself takes too long. Common causes:

  • Complex state updates triggering large re-renders
  • Synchronous data processing in event handlers
  • Heavy DOM manipulation

Diagnosis: In the Performance panel, look at the event handler's flame chart. Where is the time spent?

Fix for React:

// Slow: expensive calculation blocks render
function handleSearch(query) {
    const results = expensiveFilter(allItems, query); // blocks
    setResults(results);
}

// Fast: defer expensive work
function handleSearch(query) {
    // Mark as non-urgent update
    startTransition(() => {
        const results = expensiveFilter(allItems, query);
        setResults(results);
    });
}

startTransition tells React this state update is non-urgent. React can interrupt it to handle more urgent updates, keeping the UI responsive.

3. Presentation Delay

After your JavaScript finishes, the browser still needs to:

  • Run style recalculation
  • Perform layout
  • Paint

Long presentation delays happen when interactions trigger:

  • Layout thrash (reading then writing layout properties in a loop)
  • Large layout recalculations affecting many elements
  • Forced synchronous layout

Fix: Avoid layout thrash

// Slow: causes layout thrash
elements.forEach(el => {
    const height = el.offsetHeight; // forces layout
    el.style.height = (height + 10) + 'px'; // invalidates layout
});

// Fast: batch reads then writes
const heights = elements.map(el => el.offsetHeight); // all reads
heights.forEach((height, i) => {
    elements[i].style.height = (height + 10) + 'px'; // all writes
});

Common INP Failures by Framework

React Applications

The most common React INP issue: a click handler calls setState which triggers a large subtree re-render.

Diagnosis: Profile in React DevTools, look for renders triggered by the slow interaction.

Fixes:

  1. Use React.memo to prevent unnecessary child re-renders
  2. Move state closer to where it's used (smaller re-render subtrees)
  3. Use useDeferredValue for search/filter inputs
  4. Virtualize long lists (react-virtual, react-window)

JavaScript-Heavy Dashboards

Analytics dashboards with large data sets frequently have INP issues on tab switches, filter changes, and date range selectors.

Common pattern:

// Date range change triggers full data recalculation + re-render
function handleDateRangeChange(range) {
    const filtered = data.filter(row => isInRange(row.date, range));
    const aggregated = aggregate(filtered); // expensive
    setChartData(aggregated);
}

Fix: Web Workers for heavy computation:

const worker = new Worker('data-processor.js');

function handleDateRangeChange(range) {
    // Off main thread — doesn't block UI
    worker.postMessage({ data, range });
    worker.onmessage = (e) => setChartData(e.data);
}

Testing INP in CI

Lab tools measure TBT (Total Blocking Time), not INP. But high TBT correlates with poor INP. In CI, you can:

  1. Track TBT in Lighthouse — it's a leading indicator for INP problems
  2. Write Playwright tests that measure interaction timing:
test('search response time is under 200ms', async ({ page }) => {
    await page.goto('/products');
    
    const start = await page.evaluate(() => performance.now());
    await page.fill('[data-testid="search-input"]', 'widget');
    
    // Wait for results to appear
    await page.waitForSelector('[data-testid="search-results"]');
    
    const end = await page.evaluate(() => performance.now());
    const duration = end - start;
    
    expect(duration).toBeLessThan(200);
});

This is a synthetic interaction timing test — not the same as real INP, but catches obvious regressions.

Monitoring INP in Production

INP data from real users is more valuable than lab data. Collect it with the web-vitals library and alert when the 75th percentile exceeds your threshold.

For comprehensive production monitoring, HelpMeTest can run synthetic interaction tests against your live application on a schedule — simulating user actions and measuring response times. This bridges the gap between lab benchmarks and real user data, catching interaction regressions before CrUX data reflects them (CrUX lags by 28 days).

The free plan supports 10 continuously-running tests. A test that clicks your primary CTA, types in your search bar, and navigates between sections gives you ongoing interaction performance data without waiting for field measurements.

Read more

Start now free