What is TTFB and why it matters
Time to First Byte is how long a client waits before the server's response starts arriving. What it includes, what counts as good, and how to find which part is slow.
Time to First Byte, TTFB, is how long a client waits from starting a request until the first byte of the response arrives. Not the whole page, not the images. Just the first byte.
It matters because nothing else can happen before it. The browser can't parse HTML, fetch CSS or run scripts until the response starts arriving. A slow TTFB makes every other metric slower, including Largest Contentful Paint.
What TTFB includes
TTFB isn't one thing. It's the sum of several steps that happen one after another, and the useful part is figuring out which step is slow. Google's web.dev definition counts:
Redirects → any redirects before the final URL
Service worker → startup time, if the page has one
DNS lookup → finding the server's IP address
Connection + TLS → opening the TCP connection and negotiating HTTPS
Request → sending the request, until the first byte comes back
The last step is where the server does its work: routing the request, querying the database, rendering the response.
What counts as good
web.dev's thresholds, measured at the 75th percentile of page loads:
- Good: 0.8 seconds or less
- Needs improvement: between 0.8 and 1.8 seconds
- Poor: more than 1.8 seconds
TTFB depends on where the request comes from. A server in Europe answers European users faster than users in Asia, because the request has further to travel. Measuring from one location only shows you one part of that.
Finding what's slow
A TTFB number on its own doesn't tell you where the time went. You need the timing of each step.
DNS lookup. If DNS is slow, your DNS provider is slow or far from the user. A provider with anycast DNS servers around the world answers from somewhere close.
TCP connection. Connection time mostly reflects distance. A CDN shortens it by terminating connections at a server near the user.
TLS handshake. A full TLS 1.2 handshake takes two round trips, TLS 1.3 takes one. Check that your server supports TLS 1.3.
The request itself. If DNS, TCP and TLS are all fast and TTFB is still slow, the time is spent on the server. Slow database queries, missing caches, heavy work in the request, or a cold start on a platform that stops idle instances. This is where you look at the application.
The request waterfall
A request waterfall shows each step with its timing. Instead of "TTFB: 450 ms", you see DNS 5 ms, TCP 15 ms, TLS 30 ms, request 400 ms, and you know to look at the server.
Your browser's DevTools show this for a single request: in the Network tab, select the request and open Timing. That only shows the connection from your machine. Larm's response time checker runs the same request from several locations and shows the waterfall from each one, without signing up.
What usually helps
- A CDN in front of the site. Cached responses come from a server near the user and skip your server entirely.
- Caching. Set
Cache-Controlheaders so pages that don't change aren't generated again on every request. - Server-side performance. Look for slow queries, missing indexes, and work that could be cached or moved out of the request.
- TLS 1.3. One round trip less on every new connection.
- A fast DNS provider. It usually matters least, but it's the easiest to change.
Larm records DNS, TCP, TLS, time to first byte and transfer time on every HTTP check, from every probe location, so you can see when one of them changes.
Start monitoring in minutes.
Free plan. 15 monitors. Multi-probe voting. No credit card.
Sign Up Free