Skip to main content
More in Learn

Interaction to Next Paint (INP)

Interaction to Next Paint (INP) is a web performance metric that measures the time it takes for the browser to render the next frame after user interaction, such as a click, scroll, or typing.

INP is no longer experimental. Learn about Chrome's plan to make it a Core Web Vital in 2024.

This metric is particularly important for assessing the responsiveness of a website or application, as it provides insight into how quickly the user interface updates following user input.

A faster INP results in a more responsive and smooth user experience. To provide a good user experience, Google suggests sites should strive to have an INP of 200 milliseconds or less.

Interaction to Next Paint (INP)

Improving INP

Improving Interaction to Next Paint can be achieved through various optimization techniques including:

  1. Optimize JavaScript execution: Heavy JavaScript execution can significantly impact INP. To optimize it, minimize the use of long-running tasks by breaking them into smaller chunks, use the requestAnimationFrame() method for animations, and utilize Web Workers to offload computationally expensive tasks.
  2. Debounce and throttle event handlers: Debouncing and throttling can help limit the frequency of event handlers being called, reducing the workload on the main thread and improving INP. This is particularly important for events such as scrolling and resizing.
  3. Use passive event listeners: Passive event listeners inform the browser that the event handler will not call preventDefault() to cancel the event. This allows the browser to optimize scroll and touch events, improving INP.
  4. Optimize CSS: Heavy CSS can impact INP due to the time required for style calculations and layout. Minimize the complexity of your CSS selectors, avoid using expensive CSS properties, and remove unused styles to optimize rendering performance.
  5. Prioritize visible content: Prioritize rendering the content visible on the screen (above-the-fold) and defer the rendering of off-screen content. This can be achieved by using techniques such as lazy loading and content placeholders.
  6. Utilize virtualization: For long lists or large data sets, use virtualization libraries to render only the visible content and minimize the number of DOM elements. This reduces the workload on the browser and improves INP.
  7. Optimize animations and transitions: Use the transform and opacity properties for animations and transitions, as they are less expensive for the browser to render. Avoid animating expensive properties like width, height, and margin, which can cause layout recalculations and negatively impact INP.
  8. Minimize forced synchronous layout: Forced synchronous layout occurs when JavaScript reads and writes layout properties, causing the browser to recalculate layout multiple times. Group your read and write operations together to minimize layout thrashing and improve INP.

These are just a couple of suggestions on optimizing your INP results. Get into performance-first mindset with our comprehensive frontend performance checklist.

Continuously monitor and analyze your website's performance to identify areas for improvement and maintain a high-performing site.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community