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
| Category | What it covers | Where to look |
|---|---|---|
| Script Evaluation | Running 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 & Compilation | Turning 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 & Layout | Matching 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. |
| Rendering | Painting 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 & CSS | Reading 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 Collection | The 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. |
| Other | Work 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
- 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.
- 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.
- 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.
- 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.
- 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.
Shorten the scripts and tasks behind a busy main thread
- Website speedFind what makes your pages slow enough that visitors leave.
- JavaScript execution timeRank the scripts by the time they spend being parsed and run, then cut or delay the costliest.
- Long main-thread tasksSee which tasks block the browser for 50 ms or more during load and split them into shorter pieces.
- INP longer than 200msFind which click, tap or key press responds slowly, then shorten the work that runs before the screen updates.