Time to first byte (TTFB) measures the time from the moment a browser starts loading a page until the first byte of the server's response arrives. It covers everything that happens before the page can even begin to appear: finding the server, connecting to it and waiting for it to answer.
Because nothing can render before the first byte arrives, a slow TTFB delays every loading metric after it, including First Contentful Paint and Largest Contentful Paint.
What adds up to TTFB
TTFB isn't one delay but the sum of several steps, in this order:
- Redirects. Each redirect adds a full extra request before the real page.
- Service worker startup, if your site uses one.
- DNS lookup: turning your domain name into a server address. See DNS.
- Connection and TLS negotiation: opening the connection and setting up encryption.
- The request itself, until the first byte of the response comes back. This includes the time your server spends building the page: running code, querying the database, rendering templates.
Steps 1 to 4 depend a lot on the visitor's network and distance from your server. Step 5 is mostly your server's work.
What's a good TTFB?
Google's web.dev guidance says most sites should aim for a TTFB of 0.8 seconds or less. Values above 1.8 seconds are poor (web.dev). As with other web performance metrics, judge the 75th percentile of your real visitors, not your own fast connection.
TTFB is not one of the Core Web Vitals. Google calls the thresholds a rough guide: a server-rendered page with a slightly higher TTFB can still beat a client-rendered page on the metrics that count, because it sends usable HTML. The goal is that TTFB never stops you from reaching a good LCP.
How to measure it
Start with field data from real visitors, because lab tests often load the final URL and miss redirects.
- PageSpeed Insights shows real-user TTFB for sites with enough Chrome traffic in its "Discover what your real users are experiencing" section. Its lab run flags a slow page response under the "Document request latency" insight.
- Chrome DevTools: open the Network panel, click the page request and check the timing.
- In JavaScript, TTFB is the
responseStartvalue of the navigation entry, which theweb-vitalslibrary reports asonTTFB.
Two things can mislead you. Lighthouse's server response time audit leaves out DNS and redirect time, so it shows only part of TTFB. And if your server sends a 103 Early Hints response, that counts as the first byte, so TTFB looks earlier than the real page. Chrome briefly measured to the final response instead (from Chrome 115) but reverted in Chrome 133 because it broke comparisons between tools.
How to lower TTFB
Work through these roughly in order of impact:
- Check your hosting. Google's guidance puts hosting first. Shared hosting is often slow under load; an application with personalization and database queries needs enough memory and up-to-date software.
- Use a CDN. Servers close to your visitors cut network time, usually with fast DNS, modern TLS and HTTP/3 included.
- Cache what you can. Serve pages from the CDN's edge or a server cache instead of building them on each request, with fitting Cache-Control headers. Watch for tracking parameters in URLs: a CDN may treat each one as a different page and skip the cache.
- Remove redirect chains. Link straight to the final URL, including in ads and emails, and avoid hops such as http to https to www. More in redirects.
- Find slow backend work. Add a
Server-Timingresponse header that reports database and rendering times. You'll see them in DevTools and in real-user data, which tells you what to optimize.
Test both a cached and an uncached page. Caching can hide a slow backend: your popular pages look fast, while older pages that fall out of the cache keep a high TTFB.