What makes up TTFB
- Redirects (e.g. HTTP → HTTPS, non-www → www).
- DNS resolution and TCP + TLS connection setup.
- Server response generation time (database, rendering, APIs).
- Network distance between the user and the server.
How to reduce TTFB
The most common improvements are caching full HTML responses (CDN, reverse proxy), generating pages ahead of time (SSG/ISR instead of on-demand rendering), optimizing database queries, HTTP/2 or HTTP/3, and serving content from locations close to users.
Example
TTFB breakdown in DevTools → Network (timing waterfall) — most of the delay is often server-side (waiting/TTFB), not file download.
DNS lookup: 12 ms
TCP + TLS: 48 ms
Waiting (TTFB): 620 ms ← server generating HTML
Content download: 35 ms
─────────────────────────
Total to 1st byte: 680 msCache-Control: public, max-age=60, s-maxage=3600, stale-while-revalidate=86400