Skip to content

TTFB

Time to First Byte (TTFB) measures the delay between a request and the first byte of the response, covering DNS, TCP, TLS and server processing.

Definition

What it is

Time to First Byte is a web performance metric, defined in the W3C Navigation Timing specification. It measures the elapsed time between the moment a client initiates a request and the moment it receives the first byte of the response body. In practical terms, TTFB is the sum of several sequential phases: DNS resolution (how long it takes to map a hostname to an IP), TCP connection establishment (the three-way handshake), TLS handshake (certificate exchange and key agreement), the time the request spends in transit to the server, the time the server spends processing the request, and the time the first response byte takes to travel back to the client.

TTFB is not a single thing happening at a single layer. It is an aggregate of every step that must complete before the client sees the first sign that the server is alive. Two sites can both report "200ms TTFB" while one is doing it through a warm CDN edge in the same city and the other is doing it through a transcontinental TLS handshake. The metric is identical; the causes are entirely different. Reading TTFB correctly requires breaking it down into its components.

Why it matters

If TTFB is 800ms, then no matter how fast the page renders after that, the user will wait at least 800ms before seeing anything. LCP (Largest Contentful Paint), the Core Web Vitals metric Google uses for ranking, cannot be faster than TTFB plus the time to paint the largest element. FCP (First Contentful Paint) has the same constraint. A page with great LCP and terrible TTFB is a page whose LCP is being masked by an even worse bottleneck downstream, or whose origin happened to be fast during measurement. In production, TTFB is the metric that most directly reflects the infrastructure: server response time, CDN cache hit rate, and network path.

TTFB is also the metric most directly under the control of the backend team, not the frontend. Frontend engineers cannot change it by rewriting CSS; they can only change it by moving the server closer, caching more aggressively at the edge, or making the origin respond faster. That split makes TTFB the natural handoff point between frontend and backend performance work: the frontend owns render-blocking and LCP, the backend owns TTFB, and together they own the user experience.

How it works

In the browser, TTFB is measured through the Navigation Timing API. The performance.timing object (or the modern PerformanceNavigationTiming interface) exposes navigationStart (when the user initiated the navigation), requestStart (when the first byte of the request was sent), responseStart (when the first byte of the response arrived), and a dozen intermediate timestamps. TTFB is computed as responseStart - navigationStart. That single number hides the fact that responseStart is defined as "the first byte received", so it includes DNS, TCP, TLS, and the origin's time-to-first-byte in the response stream.

sequenceDiagram
  participant B as Browser
  participant DNS as DNS server
  participant S as Server
  B->>DNS: Resolve hostname
  DNS-->>B: IP address
  B->>S: TCP SYN
  S-->>B: SYN-ACK
  B->>S: ACK + TLS ClientHello
  S-->>B: TLS ServerHello
  B->>S: HTTP request
  S-->>B: 200 OK + first byte (TTFB timestamp)

Server-side and synthetic measurements tell a complementary story. Synthetic tools (WebPageTest, Lighthouse, Pingdom) simulate a request from a chosen location with a chosen connection profile and report TTFB as a single number, together with a waterfall that breaks it into the phases above. Real-user monitoring (RUM) tools (Google Analytics, Chrome UX Report, Datadog RUM) aggregate TTFB across real visitors, grouped by country, network type, and device. The two disagree by nature: synthetic measures a specific, controlled request; RUM measures what users actually experience. Both are needed to diagnose TTFB problems correctly.

Reducing TTFB in production

  1. Diagnose before optimizing

    Break TTFB into its phases (DNS, TCP, TLS, request queue, server processing, response) before changing anything. Each phase has a different owner and a different fix.

  2. Move the server closer to the user

    A CDN edge cuts network round-trips for TCP, TLS, and content delivery. If the origin is in one region, users in other regions pay the intercontinental latency on every cold connection.

  3. Increase cache hit rate

    A cache hit at the edge responds in single-digit milliseconds; a cache miss forwards to the origin. TTFB is dominated by hit rate, not by origin speed.

  4. Reduce origin processing time

    Measure server response time (the gap between request received and first byte sent) separately. Reduce it with database indexes, query caching, template caching, and removing synchronous work from the request path.

Dynamic pages have a structural problem with TTFB: the origin must compute something before it can send the first byte. Static pages can be served from a cache with no computation. That is why CDNs (and static site generators, and edge caching of API responses) have such outsized effects on TTFB — they convert a "compute then respond" path into a "serve from cache" path. For dynamic pages that cannot be fully cached, the pattern is partial caching: cache the shell, revalidate the fragments, and stream the response.

Common failures

A second failure is measuring TTFB only from synthetic tools run from a single location. A site that reports 100ms TTFB from Virginia and 800ms TTFB from Singapore has a TTFB problem for every user outside North America, and the synthetic report hides it. RUM is what reveals the geographic and network distribution; synthetic is what isolates the cause.

A third failure is optimizing TTFB without measuring what happens after. A page can have excellent TTFB and terrible LCP if the first byte arrives quickly but render-blocking resources delay the paint. TTFB is a means, not an end; the end is that users see something useful fast, and that depends on the whole critical path, not just the first byte.

Origin

The concept — "how long until the server starts responding" — predates the browser. Network engineers have measured time-to-first-byte since at least the 1990s, when load balancers and proxies were first instrumented for latency. The browser-side metric arrived with the W3C Navigation Timing specification (2010 draft, 2012 recommendation), which defined responseStart and navigationStart as the timestamps from which TTFB is derived. Google's PageSpeed team popularized TTFB as part of their performance recommendations in the 2010s, and the metric became a standard column in every web performance dashboard.

Time to First Byte (TTFB) is a foundational metric for measuring the responsiveness of a web server or network resource. It is the time it takes for a browser to receive the first byte of a response from a server.

— Google, *web.dev: Time to First Byte*, 2024

Evidence

Timeline

  1. 1990s — Network engineers measure time-to-first-byte at proxies and load balancers.

  2. 2010 — W3C publishes the first Navigation Timing draft.

  3. 2012 — Navigation Timing Level 1 becomes a W3C Recommendation.

  4. 2014 — Google's PageSpeed Insights surfaces TTFB as a recommended metric.

  5. 2020 — Core Web Vitals (LCP, FID, CLS) launch; TTFB becomes the diagnostic floor for LCP.

  6. 2021 — Navigation Timing Level 2 becomes a W3C Recommendation.

  7. 2024 — TTFB is a standard column in every major RUM platform.

FAQ

What is a good TTFB?

Google's guidance treats TTFB under 200ms as excellent, under 500ms as acceptable, and over 600ms as needing optimization. These thresholds are not universal: a service that must query a legacy mainframe may have a legitimate floor above 500ms. The right target is the minimum your architecture can reach without unacceptable tradeoffs, measured from the geographies and network conditions that represent your actual users.

Why is my TTFB high even with a CDN?

The most common cause is cache miss rate. A CDN only helps when it serves the response from the edge. If most requests miss the cache and hit the origin, TTFB reflects the origin's response time plus the round-trip between the edge and the origin. Check hit rate before checking anything else. A CDN with a 40% hit rate is not doing much for TTFB.

Is TTFB the same as server response time?

No. Server response time is one component of TTFB, but TTFB also includes DNS, TCP, TLS, network transit to the server, and the first-byte return trip. On a cold connection to a distant origin, server response time may be a small fraction of the total TTFB. Server response time is the part the backend team directly controls; the rest is infrastructure and geography.

Does TTFB affect SEO?

Indirectly. Google uses Core Web Vitals as a ranking signal, and LCP — one of the Core Web Vitals — cannot be faster than TTFB. A site with consistently high TTFB will struggle to achieve good LCP, which can hurt rankings. TTFB itself is not a direct ranking factor, but its downstream effect on LCP is.

How do I measure TTFB for my users in different countries?

Use RUM, not synthetic. Synthetic tools measure from the location you choose; RUM aggregates real visits from wherever your users are. Google Analytics, Datadog RUM, and Chrome UX Report all expose TTFB segmented by country. The synthetic tool tells you what a controlled request looks like; RUM tells you what your users actually experience.

Connections

TTFBLatencyLCPINPCLSCore Web VCDNCacheStale-whilLatency

● broader ● narrower ● related

Used in the garden

Sources

Etymology

Origin: acronym

  • time (noun): from Old English tima, "a limited space of time"
  • first (adjective): from Old English fyrst, "foremost"
  • byte (noun): coined in 1956 at IBM as a deliberate misspelling of "bite"

Semantic network

TTFBLatencyLCPINPCLSCore Web VCDNCacheStale-whilLatency

● broader ● narrower ● related

Used in the garden

Sources