Skip to content
Newsroom

INP diagnostics: fixing long tasks in modern web apps

22 November 2026

Long tasks are a major cause of bad Interaction to Next Paint (INP) in modern web apps. INP is the responsiveness metric that measures how quickly a webpage responds to user interactions like taps and clicks. Long tasks block the main thread, delaying these interactions and frustrating users.

What INP measures

INP measures a page's responsiveness by observing the latency of all user interactions and reporting a single value for the interaction set during a visit, according to developer.chrome.com. The INP duration can be split into three subparts: Input Delay, Processing Duration, and Presentation Delay.

  • Input Delay is the time spent waiting because other work is already occupying the main thread when the interaction happens.
  • Processing Duration is the delay caused directly by the interaction’s event handlers and related synchronous work.
  • Presentation Delay is the time spent before the next frame is rendered after the event handlers finish.

In practical terms, INP thresholds are considered good at 200 ms or less, needs improvement between 200 ms and 500 ms, and poor above 500 ms, according to web.dev.

Why long tasks hurt INP

A long task is JavaScript work that monopolizes the main thread for more than 50 ms, according to web.dev. Long tasks make the UI feel frozen and can delay interactivity even when the page appears visually ready. When a long task is running, it can create input delay, extend the processing duration, or push out the next frame, all of which hurt INP.

How to find long-task-caused INP problems

To diagnose INP problems caused by long tasks, use Chrome DevTools. The Performance panel can visualize long tasks, showing them in gray and flagging those that are over 50 ms. The Interactions track is especially useful, as it correlates user interactions with long tasks and other performance metrics.

When inspecting a slow interaction, Chrome guidance recommends using the Interactions track to see if the interaction was blocked by a long task before the event handler started, or if a long task was running inside the handler. You can also use CPU throttling in DevTools to make slow interactions easier to reproduce.

How to attribute the delay

To get more granularity on what caused the slow INP, use the onINP() function from the web-vitals library. This function can identify the slowest interaction and report attribution data, including script, style, and layout timing, according to web.dev. The Long Animation Frames API can also provide field attribution for slow INP interactions.

High style timing usually points to expensive CSS selector matching or broad style invalidation. High layout timing points to expensive geometry calculations or synchronous layout thrashing.

How to fix long tasks

Once you've identified the long task causing the slow INP, here are some strategies to fix it:

Split large scripts: Break up large scripts that run for more than 50 ms into smaller chunks that each run in under 50 ms. This ensures that the main thread is freed up more often.

Offload work: Move CPU-heavy work off the main thread where possible, for example in a service worker.

Reduce style and layout work: Minimize expensive style recalculation and layout work. This can involve optimizing CSS selectors, reducing style invalidation, and avoiding synchronous layout work in interaction handlers.

Reduce synchronous work: Minimize synchronous work in interaction handlers. This can involve breaking up large event handlers, using asynchronous APIs where possible, and batching DOM updates.

What to verify after the fix

After implementing these fixes, re-run the same interaction under the same conditions and verify that the INP score has improved. Confirm that the dominant INP phase (input delay, processing duration, or presentation delay) has improved and that the interaction now stays within the target range (200 ms or less).

Remember, real user monitoring (RUM) data is crucial for understanding INP in the field, as lab data covers only a limited subset of real user scenarios. Use the onINP() function to capture the slowest interaction in production and identify areas for further optimization.

Read also

A dark desk lit by a single lamp, two monitors showing a web page and a photo wallpaper
One lamp, two screens, late. The general feed is written and read at hours like this.Photo: StockSnap · CC0

From the desk

Front page