# Time to First Byte (TTFB)

- **Canonical URL:** https://getaimath.com/dictionary/time-to-first-byte-ttfb/
- **Topics:** [LLM Inference: Prefill & Decode](https://getaimath.com/dictionary/category/llm-inference-prefill-and-decode/)
- **Last updated:** 2026-11-25

## What is Time to First Byte (TTFB)?

**In one sentence:** Time to First Byte is how long it takes from sending a request until the first bit of data comes back.

It is a general web measurement. For AI APIs, the first byte might be a header or setup message, so it can be shorter than time to first token.

![How an AI Replies: 1. Read Your Question → 2. Type the Answer — Simple two-step cartoon: Step 1 (Prefill) shows the AI scanning your entire question in one flash (causing the brief pause before it starts talking); Step 2 (Decode) shows it typing out the reply one word at a time.](https://getaimath.com/diagrams/llm-inference-prefill-and-decode.png)
*Napkin Diagram (LLM Inference: Prefill & Decode): Every AI reply has two halves: gulping down your whole prompt at once, then speaking the answer one word at a time.*

## What is an example of Time to First Byte (TTFB)?

An API might send headers after 100 ms but the first real token after 400 ms.

## Why does Time to First Byte (TTFB) matter?

TTFB helps find delays in networks and servers.

## Related Concepts

- [Inter-Token Latency (ITL)](https://getaimath.com/dictionary/inter-token-latency-itl/): Inter-token latency is the time gap between one generated token and the next.
- [Tokens Per Second (TPS)](https://getaimath.com/dictionary/tokens-per-second-tps/): Tokens per second is how many tokens a model produces, or processes, every second.
- [Time Per Output Token (TPOT)](https://getaimath.com/dictionary/time-per-output-token-tpot/): Time Per Output Token is the average time it takes to generate each new token after the first one.
- [Prompt Processing](https://getaimath.com/dictionary/prompt-processing/): Prompt processing is the model reading and understanding your input before it starts writing an answer.
- [Time to First Token (TTFT)](https://getaimath.com/dictionary/time-to-first-token-ttft/): Time to First Token is how long you wait between sending a request and seeing the first token of the answer.
- [Token Generation](https://getaimath.com/dictionary/token-generation/): Token generation is the model producing new tokens one after another to form its answer.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/time-to-first-byte-ttfb/)
