Time to First Byte TTFB: The Complete 2026 Guide
Time to First Byte (TTFB) measures the duration between a client making an HTTP request and receiving the first byte of the response. It captures every...
- Time to First Byte TTFB measures the duration between a client making an HTTP request and receiving the first byte of the response.
- TTFB breaks down into three segments: Network latency : DNS, TCP handshake, TLS negotiation.
- Measuring TTFB from a single geographic location gives a misleading picture.
- Measure TTFB from 3+ geographic locations using curl or WebPageTest Separate network latency from server processing time Enable HTTP/3 and confirm...
Time to First Byte (TTFB) measures the duration between a client making an HTTP request and receiving the first byte of the response. It captures every step: DNS resolution, TCP connection, TLS negotiation, HTTP request transmission, server processing, and the beginning of response transfer....
What is TTFB and why it matters
Time to First Byte (TTFB) measures the duration between a client making an HTTP request and receiving the first byte of the response. It captures every step: DNS resolution, TCP connection, TLS negotiation, HTTP request transmission, server processing, and the beginning of response transfer.
Google does not use TTFB as a direct ranking signal, but it correlates strongly with Core Web Vitals that do affect rankings. A high TTFB delays every subsequent metric. The Largest Contentful Paint (LCP) element cannot begin loading until the HTML starts arriving. Good TTFB is a prerequisite for good LCP, FCP, and INP.
The anatomy of TTFB
TTFB breaks down into three segments:
- Network latency: DNS, TCP handshake, TLS negotiation. Depends on geographic distance and protocol choice (HTTP/3 reduces this significantly).
- Server processing time: Backend generating the response. Database queries, application logic, and framework overhead contribute.
- Response transmission: Time to send the first byte after the server begins writing.
The 2026 TTFB targets are:
- Good: Under 800ms
- Needs improvement: 800ms to 1.8s
- Poor: Over 1.8s
For server-side processing alone (excluding network), the target is under 200ms.
How to measure TTFB correctly
Using curl
curl -o /dev/null -s -w "TTFB: %{time_starttransfer}s\n" https://yoursite.com
Using Chrome DevTools
Check the TTFB column for the main document request. Chrome reports TTFB as requestStart to responseStart, excluding DNS, TCP, and TLS.
Using the Navigation Timing API
const nav = performance.getEntriesByType('navigation')[0];
const ttfb = nav.responseStart - nav.requestStart;
console.log(`TTFB: ${ttfb}ms`);
This gives accurate per-visitor TTFB for RUM dashboards.
How to optimize TTFB
Reduce network latency
Use a CDN to serve content from edge locations close to users. For dynamic content that cannot be cached at the edge, use CDN origin optimization. Cloudflare Argo Smart Routing and AWS Global Accelerator can reduce the network path between edge and origin.
Enable HTTP/3 to eliminate TCP head-of-line blocking and achieve 0-RTT for returning visitors. This alone can cut 100-300ms from TTFB.
Optimize server processing
Enable full-page caching. With a warm cache, server processing drops from hundreds of milliseconds to under 10ms. Use Nginx FastCGI Cache, Varnish, or a CDN edge cache.
Profile your application with an APM tool. Look for slow database queries, external API calls, and heavy middleware. Use async processing for tasks that do not need to block the response.
Use early hints
The 103 Early Hints status code lets the server push critical headers and link preloads before the full response is ready:
early_hints on;
This signals the browser to start fetching resources while the server finishes processing.
Choose the right hosting
Shared hosting gives unpredictable TTFB. Move to a dedicated VPS, bare metal, or serverless with provisioned concurrency to avoid cold start delays.
Common pitfalls
Measuring TTFB from a single geographic location gives a misleading picture. Always measure from multiple regions and separate network from server processing.
Audit: TTFB optimization checklist
- [ ] Measure TTFB from 3+ geographic locations using curl or WebPageTest
- [ ] Separate network latency from server processing time
- [ ] Enable HTTP/3 and confirm via Alt-Svc header
- [ ] Implement full-page caching for anonymous traffic
- [ ] Profile database queries and add indexes where missing
- [ ] Set up Server-Timing headers for backend timing breakdown
- [ ] Enable 103 Early Hints for critical resources
- [ ] Configure a CDN with origin optimization
- [ ] Test TTFB after each optimization change
TTFB is the gatekeeper metric. Every millisecond saved shifts the entire page load timeline earlier. Measure it accurately, optimize methodically, and verify improvements from real user monitoring data.
Citations
- Google Developer Relations. "Optimize TTFB for Better Core Web Vitals." Google Developers, 2025. https://web.dev/articles/time-to-first-byte
- Cloudflare. "What is TTFB? Time to First Byte Explained." Cloudflare Learning Center, 2025. https://www.cloudflare.com/learning/performance/ttfb/
- HTTP Archive. "TTFB Trends Report 2025." HTTP Archive, 2025. https://httparchive.org/reports/ttfb
- DebugBear. "How to Optimize TTFB: A Practical Guide." DebugBear Blog, 2025. https://www.debugbear.com/blog/ttfb