Ctrl + K
Performance18 min read

Time to First Byte (TTFB)

Understand Time to First Byte (TTFB), how the metric works, what affects it and practical ways to reduce server response time.

Published: 2026-09-02

Time to First Byte, commonly abbreviated as TTFB, is a web performance metric that measures how long a browser waits before receiving the first byte of a response from a server. It provides an early indication of how quickly a website's infrastructure can begin responding to a request.

TTFB is especially useful when diagnosing slow websites because it focuses on the time before the response body begins arriving. A high TTFB can delay everything that happens afterward, including HTML parsing, CSS discovery, JavaScript execution and the rendering of visible content.

TTFB does not describe the complete loading time of a page. Instead, it measures an important part of the request lifecycle and can help developers identify problems with DNS resolution, network connections, TLS negotiation, redirects, server processing or caching.

What Is TTFB?

TTFB measures the elapsed time between starting a request and receiving the first byte of the response. In a typical browser request, several operations may happen before the server can send data back to the client.

Browser
   ↓
DNS lookup
   ↓
TCP connection
   ↓
TLS negotiation
   ↓
HTTP request
   ↓
Server processing
   ↓
First response byte
   ↓
TTFB

The exact timing depends on the request and the environment. A cached response from a nearby server may arrive very quickly, while a dynamic request that requires database queries and server-side rendering can take considerably longer.

Why TTFB Matters

A browser cannot process the response body until the server begins sending it. When the first byte arrives late, the browser has less opportunity to parse HTML, discover resources and begin rendering the page.

  • A high TTFB delays the beginning of HTML processing.
  • Server-side rendering may take longer to produce the initial document.
  • Slow backend operations can delay every request that depends on them.
  • Poor caching can cause repeated server processing.
  • Network distance can increase response latency.
  • Redirects can add additional request time before the final response.
💡 TTFB is best used as a diagnostic metric. A low TTFB does not automatically make a page fast, but an unnecessarily high TTFB can delay many of the events that follow it.

How TTFB Is Measured

TTFB is measured from the beginning of a request until the first byte of the response is received. Browser performance APIs and performance testing tools can expose timing information for individual resources and documents.

The metric can be influenced by several stages of the network request. Depending on the measurement method, the reported value may include connection setup, redirects, DNS lookup, TLS negotiation and server response time.

StagePossible Contribution to TTFB
DNS lookupTime required to resolve the hostname
ConnectionTime required to establish a network connection
TLSTime required to negotiate HTTPS
RedirectsAdditional requests before the final response
Server processingTime spent generating or retrieving the response
Network transferTime until the first response byte reaches the client

TTFB vs Server Response Time

TTFB and server response time are related but should not always be treated as identical measurements. Server processing is one important part of TTFB, but the browser may also spend time resolving the hostname, establishing connections, negotiating TLS or following redirects.

For example, a server might generate an HTML document in 100 milliseconds, but the complete time before the browser receives the first byte can be higher because of network and connection overhead.

TTFB vs Page Load Time

TTFB measures the beginning of the response, while page load time describes a much larger part of the loading process. A page can have a fast TTFB and still be slow because it downloads large images, executes expensive JavaScript or waits for many additional resources.

MetricWhat It Represents
TTFBTime until the first response byte
FCPTime until the first piece of content is painted
LCPTime until the largest relevant content element is painted
INPResponsiveness to user interactions
Page load timeOverall duration of the loading process

What Is a Good TTFB?

There is no single TTFB value that guarantees a fast website because the appropriate target depends on the application, hosting architecture, geographic location and request type. However, a lower TTFB is generally preferable when other performance factors remain equal.

TTFB RangeGeneral Interpretation
Under 200 msVery fast response
200–500 msGenerally good
500–1000 msMay need investigation
Over 1000 msOften indicates a significant delay

These ranges are useful as practical guidelines rather than strict pass-or-fail rules. A dynamic application may naturally require more server processing than a static document, while a cached page delivered from a nearby edge server can achieve a much lower value.

⚠️ Do not optimize TTFB by sacrificing correctness, security or reliability. A slightly higher response time can be preferable to an unstable server, incorrect caching or insecure configuration.

Main Factors That Affect TTFB

TTFB is affected by both the client-server network path and the work required to produce the response. Identifying the slowest stage is more useful than optimizing one part of the system without measuring the others.

Server Processing Time

Dynamic pages often require application code to execute before a response can be generated. The server may authenticate a user, query a database, call another API, render a template or perform calculations before sending HTML or JSON.

If application code performs unnecessary work, server processing can become the dominant contributor to TTFB. Profiling backend operations can reveal slow database queries, expensive calculations and unnecessary external requests.

Database Queries

Database operations can significantly increase response time when queries are inefficient, indexes are missing or the application performs too many queries for a single request. Large datasets and unnecessary joins can also increase processing time.

  • Use appropriate database indexes.
  • Avoid fetching data that the page does not need.
  • Reduce unnecessary database round trips.
  • Cache frequently requested data when appropriate.
  • Monitor slow queries in production.

Caching and TTFB

Caching is one of the most effective ways to reduce TTFB for content that does not need to be generated for every request. A cached response can often be returned without repeating expensive application and database operations.

Cache-Control: public, max-age=3600

Caching can occur at several levels, including the browser, reverse proxy, CDN and application layer. The appropriate caching strategy depends on how frequently the content changes and whether the response is personalized.

💡 Static pages, public API responses and frequently requested resources are often good candidates for caching. Personalized responses require more careful cache configuration to avoid serving one user's data to another user.

Content Delivery Networks

A Content Delivery Network, or CDN, can reduce network latency by serving cached content from infrastructure located closer to users. Instead of every request traveling to one origin server, eligible responses can be delivered from an edge location.

CDNs are particularly effective for static assets and cacheable public responses. They can also reduce the amount of work performed by the origin server when edge caching is configured correctly.

Geographic Distance

Physical distance between a user and a server can increase network latency. A server located on another continent may require more network hops and a longer round trip than a server located close to the user.

This is one reason global applications often combine regional infrastructure with CDNs and edge caching. Serving users from infrastructure closer to their location can improve response times without changing the application's functionality.

DNS Resolution

Before a browser can connect to a hostname, it may need to resolve the domain name to an IP address. DNS lookup time can therefore contribute to the early stages of a request.

DNS caching reduces repeated lookup work, but the initial request can still require a resolver to obtain the necessary information. Reliable DNS infrastructure and sensible DNS configuration help minimize unnecessary delays.

TLS Negotiation

HTTPS connections require TLS negotiation before encrypted HTTP data can be exchanged. Connection reuse can reduce this overhead, while modern protocols and optimized network configurations can make secure connections efficient.

TLS should not be disabled simply to reduce TTFB. HTTPS is fundamental for protecting data in transit, and performance optimization should preserve secure transport.

HTTP Redirects

Redirects can increase the time required to reach the final resource because the browser must make additional requests. A request that goes through several redirects may therefore produce a noticeably higher effective TTFB for the final document.

Request
   ↓
301 Redirect
   ↓
302 Redirect
   ↓
Final URL
   ↓
Response

Reducing unnecessary redirects is especially important for navigation, canonical URLs and resources that are requested frequently. Direct links to the final URL eliminate avoidable network round trips.

Static vs Dynamic Responses

Response TypeTypical Processing
Static HTMLUsually minimal server processing
Cached HTMLCan be served directly from cache
Server-rendered HTMLApplication must generate the document
Database-backed APIMay require database queries
External API responseMay wait for another service

Static and cached responses generally have fewer processing steps than fully dynamic responses. This does not mean dynamic rendering is inherently bad. It means developers should understand which parts of a request need to happen in real time and which parts can safely be cached or precomputed.

How to Improve TTFB

Improving TTFB starts with measurement. Instead of immediately changing server configuration, identify whether the delay comes primarily from the network, connection setup, redirects, server processing, database queries or cache misses.

  • Measure TTFB from realistic geographic locations.
  • Reduce unnecessary redirects.
  • Optimize slow backend operations.
  • Improve database query performance.
  • Cache appropriate responses.
  • Use a CDN for cacheable public content.
  • Keep servers geographically close to important user groups.
  • Reuse network connections where possible.
  • Reduce unnecessary calls to external services.
  • Monitor TTFB continuously after deployments.

Optimize Backend Code

Backend code should perform only the work required to produce the requested response. Expensive calculations, repeated queries and unnecessary API calls can all delay the first byte.

Profiling tools can help identify which functions consume the most time. Once a slow operation is identified, it may be possible to optimize the algorithm, cache its result, execute independent operations concurrently or move non-critical work outside the request path.

Optimize Database Access

Database performance often has a direct effect on TTFB for dynamic applications. A query that takes several hundred milliseconds can become a major part of the response time, especially when multiple queries are executed sequentially.

Use indexes for common lookup fields, select only required columns and avoid loading large datasets when a smaller result is sufficient. Connection pooling can also reduce the overhead of repeatedly establishing database connections.

Use Appropriate Caching

Caching can prevent repeated work for responses that do not change frequently. Depending on the architecture, developers can use browser caching, reverse proxy caching, application caches, database caches or CDN edge caching.

Cache LayerTypical Purpose
Browser cacheReuse resources on the user's device
CDN cacheServe public content from edge locations
Reverse proxyCache responses before they reach the application
Application cacheReuse computed or frequently requested data
Database cacheReduce repeated database work
⚠️ Caching requires careful invalidation and privacy rules. Never make personalized or sensitive responses publicly cacheable unless the cache behavior has been explicitly designed and verified.

Reduce Redirects

Every unnecessary redirect introduces another request into the navigation process. Check HTTP responses and make sure internal links point directly to the preferred canonical URL whenever possible.

Improve Hosting Infrastructure

Hosting quality can have a substantial effect on TTFB. Limited CPU resources, memory pressure, overloaded servers and poor geographic placement can all increase response times.

For applications with significant traffic, horizontal scaling, load balancing, regional deployments and edge infrastructure can help distribute requests. The right architecture depends on traffic patterns and application requirements rather than simply choosing the largest server.

TTFB and Server-Side Rendering

Server-side rendering can improve the amount of useful HTML available when a response arrives, but it also means the server may need to execute application code before sending the document. If rendering is slow, TTFB can increase.

Frameworks that support static generation, incremental regeneration or cached server responses can reduce repeated rendering work. The goal is to choose the rendering strategy that matches how frequently the content changes and whether it depends on request-specific data.

TTFB and Core Web Vitals

TTFB is not itself one of the Core Web Vitals, but it can influence user-perceived loading performance and metrics such as Largest Contentful Paint. If the initial HTML arrives late, the browser may discover important resources later and begin rendering later.

For this reason, TTFB should be considered alongside FCP, LCP, INP and CLS rather than optimized in isolation. A performance problem should be traced through the complete loading and rendering pipeline.

How to Diagnose a High TTFB

When TTFB is unexpectedly high, divide the request into its major stages and determine where the delay occurs. Testing from multiple locations is important because a server can appear fast from one region and slow from another.

  • Check whether redirects occur before the final response.
  • Measure DNS lookup duration.
  • Check connection and TLS timing.
  • Inspect server processing time.
  • Review database queries.
  • Check whether the response was served from cache.
  • Compare results from different geographic locations.
  • Check server resource utilization during slow requests.

TTFB in Real-World Scenarios

ScenarioLikely TTFB Characteristics
Static page on nearby CDNUsually very low
Cached server-rendered pageUsually low
Dynamic page with database queriesModerate or variable
Page requiring several external APIsPotentially high
Origin server far from the userHigher network latency
Multiple redirectsAdditional delay

These scenarios demonstrate why TTFB should be analyzed in context. A high value does not identify the exact problem by itself. It tells you that the browser waited a relatively long time before the response began and that further investigation is needed.

Common TTFB Optimization Mistakes

Performance optimization can become counterproductive when developers focus on a single metric without understanding the underlying request. Several common mistakes can lead to wasted effort or even worse performance.

  • Treating TTFB as the same thing as total page load time.
  • Optimizing server code without measuring where the delay occurs.
  • Ignoring geographic differences between users and test servers.
  • Adding aggressive caching without considering content freshness.
  • Caching personalized responses incorrectly.
  • Ignoring redirects during performance testing.
  • Disabling HTTPS or security features for minor performance gains.
  • Optimizing TTFB while ignoring large images and expensive JavaScript.
  • Testing only once instead of monitoring performance over time.

Best Practices

  • Measure TTFB using realistic users and geographic locations.
  • Keep the request path as short as practical.
  • Remove unnecessary redirects.
  • Optimize backend and database operations.
  • Cache public and stable responses appropriately.
  • Use CDN infrastructure for cacheable content.
  • Keep critical application dependencies reliable and fast.
  • Monitor TTFB after deployments and infrastructure changes.
  • Analyze TTFB together with other performance metrics.
  • Prioritize improvements that benefit real users rather than chasing a single benchmark number.
💡 The most useful TTFB optimization is usually the one that removes unnecessary work from the critical request path. Measure first, identify the bottleneck, then optimize that specific stage.

Frequently Asked Questions

What does TTFB stand for?

TTFB stands for Time to First Byte. It measures the time from the beginning of a request until the browser receives the first byte of the response.

What is a good TTFB?

A TTFB below roughly 200 milliseconds is generally considered very fast, while values between 200 and 500 milliseconds are often good. These are practical guidelines rather than universal requirements because application architecture and network conditions vary.

Does TTFB affect SEO?

TTFB is not itself a Core Web Vital, but slow server responses can delay rendering and other loading metrics. Improving TTFB can therefore contribute to better overall web performance, which is relevant to user experience and search performance.

How can I reduce TTFB?

Common improvements include optimizing backend code and database queries, reducing redirects, using appropriate caching, deploying infrastructure closer to users and using a CDN for cacheable content.

Is TTFB the same as server response time?

No. Server processing is an important component of TTFB, but TTFB can also include time associated with DNS resolution, connection setup, TLS negotiation, redirects and network delivery depending on how the measurement is taken.

Can a CDN improve TTFB?

Yes. A CDN can reduce TTFB for cacheable content by serving responses from an edge location closer to the user and reducing requests that need to reach the origin server.

Why is my TTFB high even though my server is fast?

Network distance, DNS resolution, TLS negotiation, redirects, cache misses or slow dependencies can contribute to TTFB even when application processing itself is fast. Measuring the individual stages helps identify the actual bottleneck.

Does TTFB affect LCP?

It can. If the initial document or an important resource arrives late, the browser may discover and render the largest content element later. TTFB is therefore one of the factors that can influence LCP.

Helpful Performance Tools

An HTTP Response Formatter helps inspect and format HTTP response data, a Cache-Control Generator assists with creating cache directives, a TLS Version Checker helps verify supported TLS protocol versions, a DNS Lookup tool can inspect DNS records and resolution information, and a Redirect Chain Analyzer helps identify redirects that add unnecessary requests to the loading process.

Conclusion

Time to First Byte is an important diagnostic metric for understanding how quickly a website begins responding to browser requests. It covers the early part of the request lifecycle and can be influenced by DNS, network connections, TLS, redirects, server processing, databases, caching and geographic distance.

A consistently high TTFB can delay HTML processing and contribute to slower rendering, but the metric should never be optimized in isolation. The most effective approach is to measure the complete request, identify the actual bottleneck and improve the specific stage responsible for the delay.

By using efficient backend code, optimized database queries, appropriate caching, CDN infrastructure, reliable hosting and a short request path, developers can reduce unnecessary waiting before the first byte arrives. Combined with optimization of FCP, LCP, INP, CLS and other performance factors, a healthy TTFB contributes to a faster and more responsive web experience.

Found an issue?

Found an error, outdated information, or something missing from this article? Let me know through the Contact page.

Your feedback helps improve our articles and keep them accurate and useful.