0Pricing
Web Performance Optimization & Lighthouse · Lesson

Interaction to Next Paint (INP)

Understand INP, the Core Web Vital that measures real-world responsiveness, how it is computed across a visit, and the techniques to keep interactions snappy.

Interaction to Next Paint (INP) is a free Web Performance Optimization & Lighthouse lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Web Performance Optimization & Lighthouse learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Responsiveness as a Vital

Interaction to Next Paint (INP) measures how quickly the page visually responds to user input across the whole visit. It became a Core Web Vital, replacing First Input Delay.

INP vs FID

FID only measured the first interaction's input delay. INP is broader: it considers all interactions and the full latency through event handling and rendering, not just the initial delay.

What an Interaction Includes

Each interaction's latency spans three parts: input delay (waiting for the main thread), processing time (event handlers), and presentation delay (rendering the next frame).

How INP Is Reported

Across a visit, INP reports roughly the worst interaction latency (with an allowance for outliers on pages with many interactions), so it reflects the user's worst-case responsiveness.

The Thresholds

  • Good: 200ms or less
  • Needs improvement: 200-500ms
  • Poor: over 500ms

The Main Thread Is the Bottleneck

Long tasks block the main thread so input cannot be handled promptly. Breaking up long JavaScript tasks is the single biggest lever for improving INP.

Yielding to the Main Thread

Break long work into chunks and yield so the browser can handle input between them. scheduler.yield() or a setTimeout based yield helps.

async function process(items) {
  for (const item of items) {
    handle(item);
    await new Promise(r => setTimeout(r, 0));
  }
}

Defer Non-Urgent Work

Update the UI immediately for feedback, then run heavy work afterward. Patterns like requestAnimationFrame for visual updates and deferring analytics keep handlers short.

button.addEventListener('click', () => {
  showSpinner();
  setTimeout(doHeavyWork, 0);
});

Reduce Rendering Cost

The presentation phase suffers from large DOM updates and expensive layout. Use content-visibility, virtualization, and minimal DOM changes to render the next frame faster.

Measuring INP

Capture INP in the field with the web-vitals library, and use the DevTools Performance panel's interaction track to see input delay, processing, and presentation for each event.

import { onINP } from 'web-vitals';
onINP(metric => console.log('INP', metric.value));

Improvement Checklist

  • Break up long tasks and yield.
  • Defer non-urgent work after paint.
  • Trim event handler work.
  • Reduce DOM size and rendering cost.

Quick Check

How does INP differ fundamentally from the metric it replaced, FID?

Recap

You learned INP measures whole-visit responsiveness across input delay, processing, and presentation, with a good threshold of 200ms. Improve it by breaking up long tasks, yielding to the main thread, deferring non-urgent work, and reducing rendering cost.

Frequently asked questions

Is the “Interaction to Next Paint (INP)” lesson free?

Yes — the full text of “Interaction to Next Paint (INP)” is free to read here on the web, and the Web Performance Optimization & Lighthouse course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Web Performance Optimization & Lighthouse course, upgrade to CoddyKit PRO.

What will I learn in “Interaction to Next Paint (INP)”?

Understand INP, the Core Web Vital that measures real-world responsiveness, how it is computed across a visit, and the techniques to keep interactions snappy. You practise Web Performance Optimization & Lighthouse with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Web Performance Optimization & Lighthouse?

No prior experience is required. Web Performance Optimization & Lighthouse on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Interaction to Next Paint (INP)” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Web Performance Optimization & Lighthouse lesson?

Yes. Every Web Performance Optimization & Lighthouse lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Introduction to Core Web Vitals
  2. LCP, FID, CLS Deep Dive
  3. Improving User Interaction Metrics
  4. Interaction to Next Paint (INP)
← Back to Web Performance Optimization & Lighthouse