# TTFB (Time to First Byte)

> TTFB is the time from starting a request until the first byte of the response arrives. Learn what it includes, how to measure it and what usually inflates it.

Source: https://howhttpworks.com/glossary/ttfb
Last reviewed: 2026-10-04

> **TL;DR:** TTFB is how long the browser waits until the first byte of the response shows up. For a page load it counts redirects, DNS, TCP, TLS and the server's think time, not only your backend.

Time to First Byte (TTFB) is the time from the start of a request until the first byte of the response is received. In the Navigation Timing API, for a page load it is `responseStart - startTime`, so everything before the server starts replying is counted: redirects, DNS lookup, TCP and TLS setup, the request itself, and the server's processing time.

## Measuring it

```bash
curl -o /dev/null -s -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}\n' https://example.com/
```

`time_starttransfer` is the time to the first byte, measured from the start of the curl run. Subtract `time_appconnect` to get roughly the server's wait. In the browser:

```javascript
const [nav] = performance.getEntriesByType('navigation')
console.log('TTFB ms:', nav.responseStart)
```

## Non-obvious facts

- **Two definitions in circulation.** DevTools' "Waiting for server response" is only the wait after the request is sent. Field data (CrUX, RUM, PageSpeed) counts from navigation start. Compare like with like before declaring a regression.
- **Redirects count.** An `http` to `https` hop or a `www` redirect adds a full round trip, and sometimes a second TLS handshake, before the first byte of the real page.
- **Streaming changes what "first byte" means.** A server that flushes headers or a shell early gets a low TTFB even if the body takes seconds. Low TTFB alone does not mean the page is fast.
- **You can see where the time went.** Have the server emit a `Server-Timing` header (`Server-Timing: db;dur=53, app;dur=47`) and it appears in DevTools and in the Performance API.
- **Common inflators.** A cold cache or cache bypass at the CDN, a slow database query, a serverless cold start, a distant origin, and a missing connection reuse to the upstream.

## Go deeper

- [Server-Timing header](https://howhttpworks.com/headers/server-timing)
- [Cache-Control header](https://howhttpworks.com/headers/cache-control)
- [CDN](https://howhttpworks.com/glossary/cdn)
- [Request and response lifecycle](https://howhttpworks.com/guides/request-lifecycle)
