What Is TTFB? How to Reduce Time to First Byte
Time to First Byte is how long the browser waits for the first byte of your page. Learn what a good TTFB is, what slows it down and how to fix each part.
Time to First Byte (TTFB) is how long it takes from the moment the browser asks for a page until the first byte of the response arrives. Nothing can appear on screen before that byte, so a slow TTFB delays everything else, including Largest Contentful Paint.
What is a good TTFB?
| Rating | TTFB |
|---|---|
| Good | 0.8 seconds or less |
| Needs improvement | 0.8 to 1.8 seconds |
| Poor | More than 1.8 seconds |
These thresholds, published by Google's web.dev team, apply to real visits at the 75th percentile. TTFB is not a Core Web Vital itself, but because LCP should be under 2.5 seconds, a TTFB of 1.5 seconds leaves very little time for everything else. In lab tests, Lighthouse flags a slow server when the main document takes more than 600 ms to respond.
What TTFB is made of
TTFB is not only "server time". It is the sum of several steps, any of which can be the slow one:
| Step | What happens | Slow when |
|---|---|---|
| Redirects | Each redirect starts the request again | http to https to www to a trailing slash |
| DNS lookup | Finding the server's IP address | Slow DNS provider, no caching |
| Connection and TLS | Opening a secure connection | Server far from the visitor, old TLS setup |
| Server processing | Building the HTML | No page cache, slow database queries, busy server |
| First byte transfer | The response starts travelling back | Long distance, congested network |
How to measure TTFB
- Our server response time checker measures the response of your page from our scanner and shows it next to the rest of the audit.
- Chrome DevTools: in the Network panel, click the document request and open Timing. "Waiting for server response" is the server part; the rows above it show DNS, connection and TLS.
- From the command line:
curl -o /dev/null -s -w "%{time_starttransfer}\n" https://example.com/prints the time to first byte in seconds. - Real visitors: TTFB varies by location and network. A server in one country can be fast for local visitors and slow for everyone else.
Test more than once. The first request after a quiet period is often slower because caches are cold.
How to reduce TTFB
1. Cache full pages
For most sites, the biggest win is not rebuilding the same HTML for every visitor. A page cache serves a stored copy in milliseconds instead of running PHP, Python or Node and querying the database each time.
- WordPress: a caching plugin or the host's built-in page cache.
- Frameworks: full-page caching or static generation for pages that are the same for everyone.
- A CDN that caches HTML at the edge, close to visitors.
Make sure logged-in, cart and checkout pages are excluded, so visitors never see each other's data.
2. Use a CDN
A content delivery network serves your site from locations near each visitor, which cuts the connection time and, if HTML is cached, the server time as well. Even without HTML caching, a CDN usually keeps connections to your server warm, which helps.
3. Remove redirects
Link directly to the final URL. If visitors type http://example.com, one redirect to https://www.example.com/ is fine; three in a row is not. Enable HSTS so returning visitors skip the http to https redirect entirely. See 301 vs 302 redirects for setting redirects up correctly.
4. Speed up the server work
- Find slow database queries (most frameworks have a query log or debug bar) and add indexes or caching.
- Cache expensive results such as menus, settings and API calls in memory (Redis, Memcached, or the framework's cache).
- Keep the runtime current. Newer PHP, Node and Python versions are often noticeably faster.
- Turn on opcode caching for PHP (OPcache).
- Avoid calling slow external APIs while building the page; fetch them in the background or cache their results.
5. Upgrade hosting if the server is overloaded
Cheap shared hosting can be fast at 3 a.m. and slow at peak times, because many sites share one machine. If TTFB is good with a page cache but poor without it, and the cache can't be used for most pages, it may be time for more resources.
6. Use modern protocols
HTTP/2 or HTTP/3 and TLS 1.3 reduce connection setup time, especially on mobile networks. Most CDNs and modern servers support them; check that yours has them enabled.
7. Send something early
Two advanced techniques help when the server genuinely needs time to build a page:
- Streaming: send the start of the HTML (the head with CSS links) immediately, and the rest when it is ready.
- 103 Early Hints: the server tells the browser which files to preload before the main response is ready. Supported by several CDNs and modern browsers.
TTFB and SEO
Google does not use TTFB as a ranking signal on its own, but it uses LCP, and a slow server makes a good LCP almost impossible. A very slow server can also reduce how many pages Googlebot crawls per day, which matters for large sites.
Quick checklist
- Full-page cache on for anonymous visitors.
- CDN in front of the site.
- No more than one redirect to reach any page.
- Slow queries found and fixed; runtime up to date.
- HTTP/2 or HTTP/3 and TLS 1.3 enabled.
Check where your time goes with a free server response time check, then follow our speed optimization tips for the rest of the page.