Lighthouse audit mainthread-work-breakdown · Performance

Minimize main-thread work: how to fix it

Quick answer: This audit fails when the browser main thread stays busy too long during load, usually past about 4 seconds on the mobile profile. Read the category table first: Script Evaluation is the largest row on most sites. Fix it by shipping less JavaScript, deferring third-party scripts, and splitting long tasks so input can be handled between them.
View raw .md for LLMs / your notes

This Lighthouse audit fails when the browser's main thread spends too long busy during page load. The main thread is a single queue: it parses HTML, runs every line of JavaScript, recalculates styles, lays out the page, paints it, and handles every click and tap. While it is busy with one of those, it cannot do any of the others, and it cannot respond to the user. "Minimize main-thread work" is the total of that busy time, broken into categories so you can see which kind of work is eating it.

TL;DR

What does the "Minimize main-thread work" audit measure?

Lighthouse records a trace of the page load, attributes every main-thread task to a category, and sums the durations. The report shows a table like this one, taken from a real run:

CategoryTime spentWhat it is
Script Evaluation3,444 msExecuting JavaScript: framework boot, hydration, third-party tags
Style & Layout627 msRecalculating styles and computing element geometry
Other520 msMain-thread work the trace could not attribute elsewhere
Script Parsing & Compilation453 msTurning downloaded JavaScript text into executable code
Garbage Collection253 msReclaiming memory your scripts allocated
Rendering94 msPaint, composite and layerize
Parse HTML & CSS62 msBuilding the DOM and CSSOM from bytes

That total is 5,456 ms of main-thread work, and the audit scores 0.

Three properties of the measurement matter when you read your own report:

What is a good main-thread work number?

On the simulated mobile profile Lighthouse scores this audit on a curve rather than a hard cutoff. Roughly:

Do not chase the colour. The audit carries no direct weight in the Performance score; it is diagnostic. What it feeds does carry weight: main-thread work is the substance that Total Blocking Time measures the user-visible cost of, and TBT is 30% of the mobile Performance score. Cutting 1,500 ms of Script Evaluation usually shows up as a TBT improvement and a score improvement even though this audit is not scored itself.

How is this different from Total Blocking Time and "Reduce JavaScript execution time"?

These three audits look at the same trace and answer different questions. Mixing them up leads to optimising the wrong thing.

AuditQuestion it answers
Minimize main-thread workHow much total main-thread work is there, and what kind?
Total Blocking TimeHow much of that work landed in tasks over 50 ms, which is the part users feel?
Reduce JavaScript execution time (bootup-time)Which individual scripts and origins are responsible, file by file?

The practical workflow reads them in that order. This audit tells you the problem is Script Evaluation rather than Style & Layout. bootup-time names the files. TBT tells you whether fixing them will move the score.

The distinction between total work and blocking time is the one that catches people. Four hundred 10 ms tasks and one 4,000 ms task are identical here and completely different for the user. The first is responsive; the second freezes the page. If this audit is high but TBT is low, your work is already well chunked and the payoff from further splitting is limited.

How do I fix "Minimize main-thread work"?

Read the category table, find the largest row, and apply the matching playbook.

Script Evaluation is the largest row

This is the usual case, and it means you are running too much JavaScript, too early.

Style & Layout is the largest row

The browser is recalculating geometry far more often than it needs to.

Script Parsing & Compilation is unusually large

You are shipping a large volume of JavaScript bytes, regardless of whether they run.

Garbage Collection is unusually large

Something is allocating aggressively in a hot path: object creation inside animation frames or scroll handlers, large arrays rebuilt on every render, closures retained by listeners that are never removed. Profile with the DevTools Memory panel and reuse objects in the loops that show up.

"Other" is the largest row

This is usually third-party code the trace could not attribute, or extension noise. Re-run in an incognito window with extensions disabled to rule out the latter, then check the third-party section of the report. If a single origin dominates, that origin is the answer.

How do I fix this in React, WordPress, or Shopify?

React and Next.js

Hydration is the single biggest source of Script Evaluation in a React app: the framework walks the entire tree on the client to attach event handlers, and the cost scales with how much you rendered.

WordPress

The pattern is almost always plugin JavaScript loading site-wide.

Shopify

In a scan of 269 production storefronts, mainthread-work-breakdown failed on 75.8% of them (204 of 269), making it one of the most widely failed audits in the study.

What main-thread pitfalls should I avoid?

How do I verify the fix?

  1. Re-run PageSpeed Insights on the deployed URL and compare the category table row by row, not just the total. A drop in Script Evaluation with a rise in Other usually means work moved rather than disappeared.
  2. In Chrome DevTools, open the Performance panel, set CPU throttling to 4x or 6x slowdown, and record a reload. The Summary donut shows the same categories, and the flame chart names the functions behind them.
  3. Check Total Blocking Time alongside it. Total work down and TBT flat means you removed short tasks and left the long ones, which is the wrong half.
  4. Confirm the improvement reaches real users: INP and the Core Web Vitals assessment in Search Console or CrUX reflect field conditions that no lab run reproduces.

Audit your URL at https://lighthouse-md.com.

Audit your page now

Paste your URL, get scores plus a CLAUDE.md plan for Claude Code.

Run audit →
Add us as a preferred source on Google

One click, and Google shows more of lighthouse-md.com in your search results.