# What is Time to First Byte?

Time to First Byte (TTFB) is the elapsed time from starting a request or navigation until the first byte of the response arrives. Depending on where the timer starts, it can include redirect, DNS, connection, and TLS setup in addition to server processing.

<span aria-hidden="true" id="how-it-works"></span>

## How Time to First Byte works

TTFB marks the moment a response starts arriving, so everything before that moment counts toward it and nothing after it does. For a page navigation measured in the browser, web.dev lists the phases it sums: redirect time, service worker startup, DNS lookup, connection and TLS negotiation, and the request up to the first response byte. Browsers expose that moment as `responseStart` in the Navigation Timing and Resource Timing APIs. A CDN cache hit removes the trip to the origin from the total, which is why the same URL can show very different values on a cache miss and a cache hit. When a CDN is in the path, a `Server-Timing` response header can split the number further: Amazon CloudFront, for example, can report whether a response was a cache hit or a miss and, on a miss, the origin’s first-byte latency separately from its own. Servers and intermediaries choose which `Server-Timing` metrics to send, so the header shows only what they report. In media delivery, TTFB locates the delay before a playlist, segment, image, or API response begins to transfer; it says nothing about how long the body then takes to download.

<span aria-hidden="true" id="key-facts"></span>

## Key facts

1. Why do two tools report different TTFB for the same request? They start the clock at different points. The web-vitals library measures a navigation from its start, or from activation for a prerendered page, to `responseStart`, which includes redirects, DNS, connection, and TLS. Chrome DevTools labels a narrower phase “Waiting (TTFB)”: it follows the separate DNS lookup, connection, and request-sent phases and covers one round trip of latency plus the time the server took to prepare the response. curl’s `time_starttransfer` runs from the start of the transfer and includes name lookup, connection setup, and the TLS handshake. A CDN log is narrower again: CloudFront’s `time-to-first-byte` field is measured on the server, from receiving the request to writing the first byte of the response, so it contains no client network time. Match the definitions before comparing numbers or setting a target.
2. Is there a target value? For page navigations, web.dev gives a rough guide: 0.8 seconds or less is good, and more than 1.8 seconds is poor. TTFB is not a Core Web Vital, and web.dev calls the thresholds a rough guide because a server-rendered page can have a higher TTFB and still show its content sooner than a page that renders in the browser. The guide is stated for navigation requests, meaning HTML documents; web.dev gives no threshold for images, video segments, or API calls.
3. Can TTFB be measured in the field for media served from a CDN hostname? Only if the CDN allows it by sending a `Timing-Allow-Origin` response header that lists the page’s origin or the wildcard `*`. For a cross-origin resource sent without that header, the Resource Timing API reports `responseStart` as 0, along with the DNS, connection, and request timestamps. `responseStart` is also 0 for a resource retrieved instantly from a cache, so filter zeros out instead of averaging them. The same header controls whether a page can read `Server-Timing` metrics from another origin.
4. Does a 103 Early Hints response count as the first byte? In the browser APIs, yes: `responseStart` returns the time of the first interim response when there is one, and web.dev states that the 103 counts as the first bytes. `finalResponseHeadersStart` gives the start of the final response instead. Chrome reported the final response as `responseStart` from version 115 and reverted that in version 133, so TTFB data from Chrome can shift across those versions for sites that send Early Hints. Flushing response headers early has a similar effect, so a lower TTFB after enabling either is not, by itself, evidence that the main content arrives sooner.

<span aria-hidden="true" id="when-it-matters"></span>

## When Time to First Byte matters

Compare TTFB for a CDN cache miss and a cache hit of the same URL, under otherwise similar conditions, to see how much latency the miss path adds on top of the delivery path. A low TTFB does not guarantee a fast complete response because download and rendering time remain separate.

<span aria-hidden="true" id="transloadit"></span>

## How Transloadit helps with Time to First Byte

On Transloadit’s Smart CDN, a cache miss does processing work that a cache hit skips. On a miss, the request imports the original from your storage and runs your Template to produce the result; on a hit, the cached result is delivered from the edge without running anything. The Smart CDN product page reports cold and warm request timings separately and advises allowing for source fetching and transformation time when the cache is cold.

The product page does not say whether its timings are time to first byte or full response time, or whether any response bytes are sent before processing finishes on a miss, and it labels the timings as dated measurements that vary by workload. Measure your own Template by comparing a cache miss with a cache hit for the same URL. A first and a repeat request are not automatically that pair: the URL may already be cached at the edge, and the /file/serve Robot tells browsers to cache results by default, so a repeat request from a browser may be answered locally. The product page advises checking cache response headers when debugging.

* [Smart CDN: how a cache miss differs from a hit, with measured timings→](/services/content-delivery.md)
* [The /tlcdn/deliver Robot→](/docs/robots/tlcdn-deliver.md)
* [The /file/serve Robot and cache duration→](/docs/robots/file-serve.md)

[Explore Transloadit’s delivery capabilities](/services/content-delivery.md)

<span aria-hidden="true" id="references"></span>

## Sources

* [web.dev: Time to First Byte (definition, Early Hints, thresholds, measurement)](https://web.dev/articles/ttfb)
* [web-vitals library: onTTFB source](https://github.com/GoogleChrome/web-vitals/blob/main/src/onTTFB.ts)
* [W3C Resource Timing: responseStart, cross-origin resources, Timing-Allow-Origin](https://www.w3.org/TR/resource-timing/)
* [MDN: PerformanceResourceTiming responseStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseStart)
* [Chrome DevTools: Network features reference (timing breakdown phases)](https://developer.chrome.com/docs/devtools/network/reference)
* [curl man page: --write-out timing variables](https://curl.se/docs/manpage.html)
* [Amazon CloudFront: standard log fields, including time-to-first-byte](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/standard-logs-reference.html)
* [Amazon CloudFront: Server-Timing header metrics](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/understanding-response-headers-policies.html)
* [W3C Server Timing](https://www.w3.org/TR/server-timing/)

[← Thumbnails](/glossary/thumbnails.md)[Timecode →](/glossary/timecode.md)

More in delivery

* [Progressive Rendering](/glossary/progressive-rendering.md)
* [Signed URL](/glossary/signed-url.md)
* [Static Content](/glossary/static-content.md)
* [URL Transformation](/glossary/url-transformation.md)
* [Video Bandwidth](/glossary/video-bandwidth.md)
* [Video Preload](/glossary/video-preload.md)

[All 505 terms](/glossary.md)

## Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

[Try Transloadit for free](/c/signup/)
