Skip to content
Web Performance11 min read

What Is TTFB and How to Reduce Time to First Byte

ScanWise TeamEngineering & Technical Audit Team
• Updated October 22, 2026Reviewed
Network timeline diagram breaking down Time to First Byte into DNS lookup, TLS handshake, and server generation
Time to First Byte (TTFB) measures the elapsed time between a user agent requesting a web resource and receiving the initial byte of the HTTP response. To reduce TTFB below the recommended 200-millisecond threshold, engineering teams must terminate TLS at edge CDN points of presence, cache dynamic HTML responses using stale-while-revalidate policies, optimize blocking database queries, and employ streaming server-side rendering (SSR) so the browser preload scanner can discover critical stylesheets while server data loads.

What Is Time to First Byte (TTFB)?

Time to First Byte is a fundamental web performance diagnostic metric that quantifies the responsiveness of your origin infrastructure and network transit. According to web.dev guidance on optimizing TTFB, TTFB encompasses three distinct sequential phases: (1) Network request propagation and DNS resolution, (2) Server-side processing and backend database execution, and (3) Initial HTTP response header transmission over the wire.

For a concise definition of metric boundaries, see our TTFB glossary entry. In our broader how to improve page speed pillar guide, we identify TTFB as the absolute performance ceiling: if your server takes 700 milliseconds to transmit the first byte, your page cannot paint content faster than 700 milliseconds under any conditions.

Diagram illustrating TTFB network lifecycle phases from DNS resolution to first byte transmission
Figure 1: Anatomy of Time to First Byte: DNS lookup, TCP connect, TLS negotiation, and server processing.

Official TTFB Thresholds and Impact on Core Web Vitals

According to Chrome Web Vitals standards, TTFB ratings are categorized into three distinct performance tiers evaluated at the 75th percentile of real-world page visits:

Google Web Vitals TTFB Thresholds

Time to First Byte performance classification tiers
Rating TierMeasured ThresholdImpact on User Experience
Good<= 800 ms (Target: < 200 ms)Immediate server response; browser begins rendering without noticeable delay.
Needs Improvement800 ms – 1,800 msNoticeable white-screen delay; risks pushing LCP past the 2.5-second threshold.
Poor> 1,800 msSevere server stall; triggers user abandonment and high mobile bounce rates.

While Google specifies 800 milliseconds as the boundary for 'Good', modern websites operating on edge networks routinely achieve TTFB values between 50 and 150 milliseconds. Because Largest Contentful Paint (LCP) includes TTFB as its first sub-part, every 100 milliseconds shaved from server response time translates directly into a 100-millisecond reduction in LCP.

Four Architectural Fixes to Dramatically Reduce TTFB

Reducing TTFB requires addressing both network transport latency and origin compute overhead. The following four strategies eliminate the most severe server-side bottlenecks:

1. Terminate TLS and Cache Dynamic HTML at the Edge

When an overseas visitor accesses a central server in North America, each TCP and TLS packet must cross physical oceans, adding 150–300 milliseconds of round-trip transit time (RTT). By routing traffic through an Edge CDN (such as Cloudflare, Fastly, or Vercel Edge Network), the TLS cryptographic handshake is terminated at a local point of presence mere milliseconds from the user.

src/app/api/cache-headers/route.tsIllustrative Example
// Configuring stale-while-revalidate edge caching headers in Next.js
export async function GET() {
  return new Response(JSON.stringify({ status: "ok" }), {
    headers: {
      "Content-Type": "application/json",
      // Serve cached content immediately; revalidate in background
      "Cache-Control": "public, max-age=60, s-maxage=3600, stale-while-revalidate=86400",
      "CDN-Cache-Control": "public, s-maxage=3600",
    },
  });
}

2. Adopt Streaming Server-Side Rendering (React 19 & Next.js)

In traditional monolithic SSR, the server must wait for all database queries and external microservices to finish before returning a single byte of HTML. With streaming SSR and React Suspense, the server immediately flushes the document <head>, CSS links, and page skeleton within 30–50 milliseconds. The browser can preload fonts and hero images while secondary dynamic blocks stream in as their data resolves.

Comparison timeline showing traditional blocking SSR versus progressive streaming SSR
Figure 2: Streaming SSR flushes the HTML document head immediately, unblocking browser resource discovery.

3. Eliminate N+1 Queries and Inefficient Database Joins

Unindexed database queries are a primary culprit behind inflated server latency. If rendering a single dashboard or category route triggers 25 separate database roundtrips (the classic N+1 problem), server response time will degrade exponentially under concurrent traffic. Always audit database query execution plans, create indexes on foreign keys, and memoize query responses using Redis or in-memory LRU caches.

4. Enable HTTP/3 and QUIC Protocols

HTTP/3 operates over QUIC, a modern UDP-based transport protocol standardized in IETF RFC 9114. Unlike TCP, which suffers from head-of-line blocking whenever a single packet drops on mobile networks, QUIC multiplexes streams independently and supports zero-round-trip resumption (0-RTT), accelerating reconnection times for returning visitors.

Server & Infrastructure TTFB Checklist

Step-by-Step Procedure: Diagnosing TTFB in Production

Four-Step TTFB Diagnosis Procedure

  1. Step 1: Isolate Network Latency Using curl Command-Line Timing

    Execute curl with custom timing formatting (curl -w "@curl-format.txt" -o /dev/null -s https://example.com) to measure precise DNS lookup, TCP connect, and starttransfer durations.
  2. Step 2: Inspect Server Timing Headers (Server-Timing API)

    Emit Server-Timing: db;dur=45, cache;dur=2 response headers from your backend. Inspect the Chrome DevTools Network Timing tab to see exactly how much time was spent in database versus template rendering.
  3. Step 3: Verify Edge CDN Cache Hit Ratios

    Inspect response headers for cf-cache-status: HIT or x-vercel-cache: HIT. If your dynamic pages consistently return MISS, adjust your Cache-Control max-age and cookie bypass rules.
  4. Step 4: Benchmark Cold Starts in Serverless Environments

    If running on AWS Lambda or serverless functions, measure the difference between cold and warm invocations. Keep function bundle sizes small to maintain cold starts under 150ms.

Common Mistakes in TTFB Optimization

Top 3 TTFB Anti-Patterns

Top 3 TTFB Anti-Patterns
MistakeWhy It HurtsThe Fix
Executing blocking third-party API calls during SSR.If an external payment or authentication API takes 600ms to respond, your server cannot emit HTML, causing high TTFB.Move non-critical third-party integrations to asynchronous background workers or client-side fetch calls.
Relying on client-side SPA fetching for all data.While client-side fetching yields a fast initial empty HTML shell (low TTFB), it destroys LCP and FCP because content cannot render until secondary scripts load.Use streaming SSR with Suspense: deliver fast first bytes while streaming actual content.
Chaining redirects across protocol, www, and trailing slash.Each redirect hop requires a complete HTTP request/response cycle, adding 150ms to 400ms per hop to total TTFB.Normalize all internal links to their final canonical format and resolve edge redirects in a single hop.

How to Measure TTFB Accurately with Real Tools

Measuring TTFB requires isolating network transmission from server computation. The following tools provide accurate diagnostic data without synthetic distortion:

  • Chrome DevTools Network Tab: The 'Waiting for server response' bar in the Waterfall tab reflects exact TTFB for each individual network request.
  • MDN PerformanceResourceTiming API: Programmatically capture responseStart - requestStart in real-user monitoring (RUM) scripts across real human sessions.
  • cURL Command Line: The most reliable method to test origin server performance without browser extension interference or client rendering overhead.
  • ScanWise Performance Audits: Automatically benchmarks TTFB across multiple pages, highlighting server latency bottlenecks alongside Core Web Vitals.

Sources & Primary Documentation

Tags:#TTFB#Server Response Time#Edge Computing#Page Speed#Core Web Vitals#Next.js

Frequently Asked Questions

What is a good TTFB threshold according to Google guidelines?

Google recommends a Time to First Byte under 800 milliseconds for 75% of page visits in real-user field data. However, high-performing websites deployed on modern edge CDNs target a TTFB under 200 milliseconds on cached pages and under 400 milliseconds on dynamic SSR pages.

Why does TTFB matter if Largest Contentful Paint (LCP) is the Core Web Vital?

TTFB is the foundational prerequisite for LCP. The browser cannot begin parsing HTML, downloading stylesheets, or discovering hero images until the first byte arrives. A slow TTFB directly delays LCP millisecond for millisecond.

Can a CDN reduce TTFB for dynamic, uncacheable database queries?

Yes, but primarily on the network phase. An edge CDN terminates the user's TLS handshake locally, saving 100-300ms of cross-continental network latency. However, for the compute phase itself, dynamic database queries must still be optimized at the origin or edge database layer.

How does HTTP/3 or QUIC protocol impact server response latency?

HTTP/3 operates over UDP and eliminates TCP head-of-line blocking. It supports 0-RTT connection resumption, allowing returning users to send HTTP requests simultaneously with their TLS handshake, noticeably reducing initial connection latency.

How do you measure TTFB in Chrome DevTools versus synthetic Lighthouse runs?

In Chrome DevTools, inspect the Network tab and hover over the 'Waiting for server response' segment in the Waterfall. In Lighthouse, TTFB is reported in the 'Server response times are low' audit, which simulates mobile CPU and network throttling.

ScanWise Team

Engineering & Technical Audit Team

The ScanWise engineering and technical SEO team researches web performance, Core Web Vitals, crawl mechanics, and digital compliance.

Related Engineering Guides