Time to First Byte (TTFB)
TTFB measures how long it takes for the browser to receive the first byte of data from your server after making an HTTP request.
It reflects server processing time, network latency, and caching. A high TTFB can slow down all your other performance metrics.
TTFB Benchmarks
These ranges are ballpark values. The right target depends on your stack and users, but lower is always better.
Understanding what TTFB represents
From the moment a user clicks a link, several things must happen before the first byte of the response arrives: DNS lookup, TLS handshake, and server-side processing.
TTFB is particularly sensitive to backend performance and caching. It is also affected by how close your users are to your server or CDN edge.
- 1 DNS resolution and connection setup between browser and server.
- 2 Server receives the request, runs application code, and queries databases.
- 3 First byte of the HTTP response is sent back to the browser.
Typical contributors to slow TTFB
- Slow or overloaded web server
- Heavy database queries without caching
- Dynamic pages without page caching
- Long-running third-party API calls
- High network latency (server too far from users)
Practical ways to reduce TTFB
Focus on caching, database performance, and infrastructure before micro-optimizing front-end code.
Enable full-page caching
Serve pre-generated HTML for anonymous users so that the server does not have to run the entire application stack on every request.
- Use a caching plugin or reverse proxy
- Set sensible cache lifetimes
- Purge cache on content updates
Use a CDN wisely
Place your static assets and even full HTML pages on a CDN edge close to users, reducing latency and offloading work from your origin server.
- Enable caching at the edge
- Serve images, CSS, JS from CDN domains
- Choose PoPs near your main markets
Optimize your backend
Profile slow database queries, remove unnecessary work from request handlers, and keep your runtime and libraries up to date.
- Add indexes to frequently queried columns
- Offload heavy jobs to queues
- Use connection pooling and persistent connections
Checking your TTFB in tools
Many performance tools expose TTFB directly in their waterfalls or timing breakdowns.
Browser DevTools
Open the Network tab, reload the page, and inspect the first document request to see TTFB in the timing details.
GTmetrix & similar tools
Waterfall charts highlight how long the server spends before sending the first byte for each request.
Real-user monitoring
Some RUM solutions capture backend timing, helping you correlate slow TTFB with specific regions, pages, or time periods.
Common causes of high TTFB
TTFB is often dominated by backend work and network latency. These are the typical causes to check first.
No caching for HTML
If every request renders a page from scratch, TTFB will be higher. Full-page caching is often the biggest win.
- • Add page caching for anonymous traffic
- • Cache safely and purge on updates
- • Avoid cache-busting on every request
Slow database / backend work
Heavy queries, slow plugins, or third-party API calls can delay the first byte. Profile before optimizing.
- • Identify slow routes/templates
- • Reduce blocking API calls
- • Use indexes and caching layers
Distance & latency
If users are far from the origin, latency increases. A CDN can reduce distance and serve cached responses closer to users.
- • Use a CDN for assets
- • Consider edge caching for HTML
- • Choose hosting near key regions
TTFB quick checklist
These items help you reduce time before the server starts responding. Keep changes measurable and reversible.
Caching & delivery
- • Enable page caching (and verify cache hit rate)
- • Use a CDN for static assets and consider edge caching
- • Keep HTML responses lean (avoid unnecessary server work)
Backend efficiency
- • Profile slow templates/routes and remove bottlenecks
- • Cache expensive database queries
- • Avoid blocking third-party API calls on page load
FAQ: reducing TTFB
Quick answers to common backend and hosting questions that affect Time to First Byte.
Is TTFB only a hosting problem?
Not always. Hosting matters, but TTFB also depends on caching, backend work, database queries, and where your users are located.
Will a CDN improve TTFB?
A CDN can reduce latency and speed up cached responses. It helps most when users are far from the origin server or when assets are heavy.
Why does TTFB change over time?
Server load, cache hit rate, background jobs, and third-party calls can vary. Monitor trends and investigate spikes.
Can plugins/tools reduce TTFB?
Tools that add caching or optimize delivery can help, but you should verify behavior (cache hits, correct purging) and avoid breaking dynamic pages.
How do I confirm the improvement is real?
Test the same URL multiple times, compare before/after deploys, and check multiple regions if you serve a global audience.
TTFB slowing everything down?
Start with caching and hosting improvements, then dig deeper into code-level optimizations. Every millisecond you shave off TTFB helps all your other metrics.