Skip to main content
Performance

Interaction to Next Paint (INP)

Published:
Updated:

Interaction to Next Paint (INP) measures page responsiveness: the time from a user interaction (a click, tap or key press) to the next paint in which the effect of that interaction becomes visible. A page's score is close to the worst latency observed during the entire visit.

In March 2024, INP replaced First Input Delay (FID) as a Core Web Vitals metric, because it measures the full cost of handling an interaction rather than just the delay in starting it. A good score is at most 200 ms at the 75th percentile.

The three phases of every interaction

  • Input delay: waiting for the main thread to be free to run the handler.
  • Processing time: executing the event handler code.
  • Presentation delay: recalculating layout and painting the next frame.

How to improve INP

The key is unblocking the main thread: breaking up long tasks (yielding), reducing and deferring JavaScript, avoiding unnecessary re-renders, and limiting expensive DOM operations inside event handlers.

Example

Educational example: show progress and yield between chunks. scheduler.yield() or a setTimeout fallback creates an opportunity for other tasks; awaiting requestAnimationFrame alone does not ensure a paint. Profile chunk sizes and handle errors and repeated clicks. Fast visual feedback does not mean the whole asynchronous operation is finished.

Hurts INP: synchronous loop in handler
JavaScript
button.addEventListener('click', () => {
  for (let i = 0; i < items.length; i++) {
    processItem(items[i]); // blocks the main thread
  }
  updateUI();
});
Better: task splitting (yield)
JavaScript
const yieldTask = () => globalThis.scheduler?.yield
  ? globalThis.scheduler.yield()
  : new Promise(resolve => setTimeout(resolve, 0));

button.addEventListener('click', async () => {
  button.disabled = true;
  status.textContent = 'Processing…';
  try {
    await yieldTask();
    for (let i = 0; i < items.length; i += 100) {
      for (const item of items.slice(i, i + 100)) processItem(item);
      await yieldTask();
    }
    updateUI();
    status.textContent = 'Done';
  } catch {
    status.textContent = 'The operation could not be completed';
  } finally {
    button.disabled = false;
  }
});

Sources & further reading

Check your site performance

Insight measures Core Web Vitals and ranks bottlenecks by impact.