PageSpeed Matters
    PageSpeed Matters
    Interactivity & Rendering · Glossary

    Long Tasks · Definition & Explanation 2026

    Long Tasks are any JavaScript or browser tasks that occupy the main thread for more than 50 milliseconds. During a long task, the browser cannot process user input — clicks, taps, and keypresses queue up, making the page feel frozen or sluggish.

    Long tasks are the root cause of poor INP (Interaction to Next Paint) and high TBT (Total Blocking Time). Breaking long tasks into smaller chunks under 50ms is the single most impactful optimization for web responsiveness.

    The Long Tasks API (PerformanceObserver) allows developers to programmatically detect long tasks in production. Chrome DevTools visualizes them as yellow/red bars in the Performance panel flame chart. In 2026, the new `scheduler.yield()` API provides the most reliable way to break long tasks.

    Updated 2026-02-28
    M
    By Matt Suffoletto

    TL;DR — Quick Summary

    Long Tasks are main-thread tasks exceeding 50ms that block user input. They're the root cause of poor INP and high TBT. Break them with scheduler.yield(), setTimeout(0), or Web Workers.

    What is Long Tasks?

    A Long Task is any task that runs on the browser's main thread for 50 milliseconds or more. During a long task, the browser cannot process user input, making the page feel unresponsive.

    The 50ms threshold comes from the RAIL model: to feel instant, the browser must respond to user input within 100ms. Since the browser needs ~50ms for its own work (rendering, compositing), only 50ms is available for JavaScript. Any task exceeding this budget blocks user interactions.

    The blocking time of a long task is the portion exceeding 50ms. A 70ms task has 20ms blocking time; a 200ms task has 150ms. TBT sums all blocking times during loading.

    History & Evolution

    • 2017 — Long Tasks API proposed as a W3C specification for detecting main-thread blocking.
    • 2019 — TBT introduced in Lighthouse, directly measuring long task impact during loading.
    • 2024 — INP replaces FID as CWV, making long task optimization critical for all interactions, not just the first.
    • 2025–2026 — scheduler.yield() available in Chrome 129+, providing the standard way to break long tasks.

    How Long Tasks is Measured

    Detection tools:

    • Long Tasks API — `new PerformanceObserver(list => {}).observe({type: 'longtask'})` detects long tasks programmatically in field.
    • Chrome DevTools Performance panel — Long tasks appear as yellow/red bars in the flame chart. Click to see which functions are responsible.
    • Lighthouse — 'Avoid long main-thread tasks' audit lists all long tasks during loading.
    • Web Vitals library — Reports INP attribution including long task information.

    Key rule: Field data (CrUX) determines Google rankings. Lab data (Lighthouse, WebPageTest) is for debugging and iteration.

    Common Causes of Poor Long Tasks Scores

    1. 1Large JavaScript execution — Parsing and executing a 500KB+ script bundle.
    2. 2DOM manipulation — Adding/removing hundreds of elements at once.
    3. 3Complex calculations — Data processing, sorting, filtering large arrays.
    4. 4Framework rendering — React reconciliation, Vue reactivity, Angular change detection.
    5. 5Third-party scripts — Analytics, chat widgets, A/B testing tools.
    6. 6Layout thrashing — Reading layout properties then writing DOM changes in a loop.

    Frequently Asked Questions

    For step-by-step optimization, platform-specific fixes, code examples, and case studies, read our full guide:

    The Ultimate Guide to Core Web Vitals: How to Pass All Metrics & Boost Rankings in 2026

    Struggling with Long Tasks?

    Request a free speed audit and we'll identify exactly what's holding your scores back.