INP (Interaction to Next Paint)
A Core Web Vital measuring the latency from any user click, tap, or keypress until the browser paints the next visual frame across the page's entire lifecycle
Table of Contents
Structure Diagram
What is INP (Interaction to Next Paint)?
A Core Web Vital measuring the latency from any user click, tap, or keypress until the browser paints the next visual frame across the page's entire lifecycle. It is a core concept in Performance & Optimization within Web Dev.
Core Principles
Interaction to Next Paint (INP) replaced First Input Delay (FID) as a Core Web Vital in 2024. While FID only measured the delay before the very first interaction began, INP observes every click, tap, and keyboard interaction across the entire session and reports the worst (near-98th percentile) latency until the next visual frame paints.
INP consists of three phases: 1) Input Delay (waiting for an ongoing Long Task), 2) Processing Duration (running event callbacks), and 3) Presentation Delay (layout and paint). A good INP is ≤ 200ms.
Practical Takeaways
- Break up Long Tasks and yield to the main thread: Any synchronous JS block over 50ms stalls user input. Paint immediate visual feedback first, then yield heavy follow-up work using
scheduler.yield()orsetTimeout. - Defer non-urgent state updates: Use React's
startTransitionso typing in an input remains instantaneous while expensive list filtering runs at lower priority. - Trim DOM size and offload computation: Oversized DOM trees inflate presentation delay—adopt virtual scrolling and move heavy sorting/parsing to a Web Worker.
Notable Examples
- Interactive filter panels & data tables: Switching synchronous filter updates to transitions plus virtualized rows frequently drops INP from 400ms+ to under 100ms.
- Analytics click handlers: Moving synchronous tracking payloads to
navigator.sendBeacon()removes hidden processing delay on every button click.