Find what kept the browser's main thread busy while your page loaded

Minimize main-thread work is the Lighthouse and PageSpeed Insights diagnostic that appears when the browser's main thread stayed busy for more than about 2 seconds while the page loaded. The main thread parses HTML and CSS, works out styles and layout, and runs your JavaScript, and while it's busy the page may not respond to clicks and taps. The diagnostic kept its name in Lighthouse 13. Its table splits the time by kind of work, which tells you whether to look at your scripts, your styles or the structure of the page.

What each category in the breakdown means

CategoryWhat it coversWhere to look
Script EvaluationRunning JavaScript, including framework startup and third-party tags.The Reduce JavaScript execution time diagnostic names the scripts behind it. Defer, split or remove the biggest.
Script Parsing & CompilationTurning downloaded JavaScript into code the engine can run, before any of it executes.Send less JavaScript: split bundles by route and remove code the page never uses.
Style & LayoutMatching CSS rules to elements and working out the size and position of everything.Simplify selectors, shrink a very large DOM and stop scripts from reading layout right after changing styles, which forces extra layout passes.
RenderingPainting pixels and putting the page's layers together on screen.Animate transform and opacity rather than properties that repaint, and keep painted areas small.
Parse HTML & CSSReading the HTML document and the stylesheets.Trim oversized HTML, such as large blocks of inline data, and remove CSS the page doesn't use.
Garbage CollectionThe JavaScript engine reclaiming memory the page no longer needs.Measure the page's memory use and look for scripts that create and discard large amounts of data.
OtherWork Lighthouse couldn't place in another category.Record the load in the DevTools Performance panel to see the individual tasks. Chrome's guide links advice for each category.

Why the numbers look worse than on your computer

  • Mobile runs in Lighthouse and PageSpeed Insights model a processor four times slower than the machine doing the test, to approximate a mid-tier phone, as Lighthouse's throttling documentation explains. In that default simulated mode, the audit's source code multiplies each category's measured time by the same factor, so one second of work on a fast laptop reports as about four. That scaled total is what the audit scores, and the same file passes it up to 2,017 ms, though Chrome's older guide still says 4 seconds.

  • That's deliberate: the report aims to show how the page behaves on an ordinary phone, not on a developer's desktop. Treat the breakdown as a ranking of where the time goes, and compare runs made with the same device setting, since desktop runs apply no CPU slowdown.

How to minimize main-thread work

  1. Start with the largest categoryOpen the diagnostic and note which category takes the most time. Script Evaluation or Script Parsing at the top points at JavaScript; Style & Layout points at the page's CSS and DOM.
  2. Record the load in DevToolsIn the Performance panel, turn on CPU throttling, record a reload and open the Bottom-Up tab. Group by activity or by URL to see which scripts and rendering steps take the time.
  3. Cut JavaScript before tuning itRemove scripts and tags the page no longer needs, split bundles by page and load code for features below the first screen later. Less script lowers both parsing and evaluation time.
  4. Move heavy work off the main threadWork that doesn't touch the page, such as parsing a large file or sorting a big list, can run in a web worker, which has a thread of its own.
  5. Test again with the same settingsCompare the breakdown before and after on the same device setting and the same URL, so a change in the numbers comes from your fix.

Frequently asked questions

Is main-thread work the same as Total Blocking Time?

No. The diagnostic adds up everything the main thread did during load. Total Blocking Time counts only the part of each task beyond 50 milliseconds after First Contentful Paint, and it's one of the metrics in the performance score. Cutting main-thread work usually brings it down.

Can I move everything into a web worker?

No. Web workers don't have access to the DOM, so style, layout and rendering stay on the main thread. Workers suit data processing whose result the page then displays, as web.dev's guide to working off the main thread explains.

Does a slow server cause this warning?

Not directly. Waiting for the network leaves the main thread idle, so a slow server shows up in time to first byte rather than here. The categories measure work the browser did with the files once they arrived.