Troubleshooting guide
How to reduce Total Blocking Time (TBT)
TBT adds up how long the main thread was too busy to respond during page load. It predicts how responsive your page will feel.
3 min read10 sectionsUpdated
On this page
What TBT measures
Between First Contentful Paint and Time to Interactive, each task longer than 50 ms adds its time above 50 ms to TBT. A 250 ms task adds 200 ms. Good is 200 ms or less on a mid-range mobile profile. It correlates well with INP, which is the real-user metric Google actually uses.
Find long tasks
In Chrome DevTools, record the Performance panel with 4x CPU slowdown, and look for red-flagged tasks. In the field, the Long Tasks and Long Animation Frames APIs report them.
// Log long tasks in the page
new PerformanceObserver((list) => {
for (const e of list.getEntries()) console.log(Math.round(e.duration), e.name, e.attribution?.[0]?.containerSrc);
}).observe({ type: 'longtask', buffered: true });
# Lab TBT from the command line
npx lighthouse https://example.com --only-audits=total-blocking-time,mainthread-work-breakdown,bootup-time --quiet --output=json | python3 -c "import sys,json; print(json.load(sys.stdin)['audits']['total-blocking-time']['displayValue'])"Fixes
Remove what you do not need, following reduce JavaScript bundle size. Code-split by route. Hydrate less: use server components or partial hydration. Break up long work by yielding with scheduler.yield() or setTimeout. Move calculations to a Web Worker. Load third-party widgets on interaction, or after the page is idle, and consider a facade for heavy embeds such as chat or video.
Why phones suffer more
The same JavaScript can take four or five times as long on a mid-range Android phone as on a developer's laptop, and a large share of the web's visitors use devices like that. That is why tests use CPU throttling. Download size is only part of the cost: a 500 KB bundle costs more than a 500 KB image, since it must also be parsed, compiled and run. If you have only checked on a fast machine, throttle the CPU in DevTools, and you will probably see a very different page.
Catch it automatically
Run a lab check in CI against a budget, and follow INP and long tasks with real-user monitoring. Check INP tests a single page.
Related reading
- What is Total Blocking Time (TBT)?: Total Blocking Time explained: long tasks, how TBT is calculated, the 200 ms target in Lighthouse, how it relates to INP and how to break up main-thread work.
- DNS propagation: how long it takes and how to check it: How DNS propagation really works: why TTL decides the wait, how nameserver changes differ, how to check resolvers with dig and how to migrate with no downtime.
- How to reduce TTFB (server response time): Practical ways to reduce time to first byte: edge caching, fewer redirects, faster queries, warm runtimes and closer servers, in order of impact.
- MySQL slow query log: how to enable and read it: Enable the MySQL slow query log without a restart, choose a sensible threshold, summarise it with mysqldumpslow and pt-query-digest, and fix what it finds.
- What is alert flapping?: Alert flapping explained: why alerts fire and resolve over and over, and the fixes that work: sustained conditions, hysteresis, cooldowns and grouping.
- What is TTFB (time to first byte)?: Time to first byte explained: what TTFB measures, the 0.8 second threshold, the phases that add up to it, how to measure it and how to cut it.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.