What is Time to First Byte (TTFB)?
The time between a browser requesting a page and receiving the first byte of data from the server.
Definition
Time to First Byte (TTFB) measures the duration from when a user's browser sends an HTTP request to when it receives the first byte of the response from the server. TTFB includes DNS lookup time, TCP connection time, SSL/TLS negotiation, and server processing time. It is a key indicator of server-side performance and network latency.
TTFB can be broken down into its component phases to identify exactly where delays occur. DNS lookup resolves the domain name to an IP address (typically 20-120ms). TCP connection establishes the network connection (variable by distance). SSL/TLS handshake establishes encryption (typically 50-150ms). Server processing is where the server generates the response (highly variable, from milliseconds for cached pages to seconds for complex database queries). Understanding which phase contributes most to your TTFB tells you where to focus optimization efforts.
Why It Matters
TTFB sets the baseline for every other performance metric. A slow TTFB means that no matter how optimized your frontend is, users will still experience delays, the browser cannot begin parsing HTML, loading resources, or rendering content until it receives the first byte from the server. High TTFB can indicate server overload, slow database queries, insufficient caching, or geographic distance between the server and the user.
Improving TTFB has a cascading positive effect on every downstream metric. Shaving 500ms off TTFB typically improves First Contentful Paint and Largest Contentful Paint by a similar amount, since both depend on receiving the HTML document first. For sites with complex server-side rendering, TTFB is often the single largest bottleneck. Google considers TTFB a diagnostic performance metric (not a Core Web Vital directly), but slow TTFB is a root cause of poor LCP, which is a Core Web Vital and ranking factor.
How to Measure
Measure TTFB using browser DevTools (Network tab), performance audit tools, or real-user monitoring. A good TTFB is under 800 milliseconds, with excellent performance under 200ms. In Chrome DevTools, look at the Waiting (TTFB) value in the Network panel for your document request. Google Search Console also surfaces server response time data. Test from multiple geographic locations to understand how distance from your server affects TTFB for different audiences.
Compare TTFB across different page types to identify patterns. If TTFB is fast on static pages but slow on pages with database queries or server-side rendering, the bottleneck is in server processing. If TTFB is consistently slow across all pages, the issue is more likely infrastructure-related (hosting, DNS, or lack of CDN). Track TTFB trends over time, a gradual increase often indicates growing database queries, increasing traffic without scaling, or accumulated server-side complexity.
How Racoons.ai Helps
Racoons.ai includes server response time in its performance audits, flagging when TTFB is slow. Our AI analysis highlights how server-side delays cascade into poor load times and suggests areas to investigate, like caching, hosting, or CDN usage.
Best Practices
Implement server-side caching as your first optimization, caching the full HTML response for pages that don't change frequently can reduce TTFB from seconds to milliseconds. Use a CDN to serve content from edge servers geographically close to your visitors, eliminating the latency penalty of long-distance requests. For dynamic pages, consider edge computing or stale-while-revalidate caching strategies that serve cached content immediately while refreshing the cache in the background.
Optimize your server-side code path for your most-visited pages. Profile database queries to identify and fix slow queries (missing indexes, N+1 queries, excessive joins). Use connection pooling to avoid the overhead of establishing new database connections for each request. Enable HTTP/2 or HTTP/3 on your server and CDN to reduce connection overhead. Implement DNS prefetching and preconnect hints for critical third-party origins so browsers can begin DNS resolution and connection setup before they're needed.
Put this knowledge into action
Understanding the metrics is the first step. Racoons.ai uses AI to analyze your website and tell you exactly what to improve, in plain English.
Try the full analysis free