--- title: TTFB (Time to First Byte) description: "The time from request to the first byte received. High TTFB is usually server, database, or cache — not file size." canonical: https://penasihathosting.com/en/hosting-wiki/ttfb type: wiki locale: en updated: 2026-10-29 author: Willya Randika --- # TTFB (Time to First Byte) ## Overview - **Summary:** The time from request to the first byte received. High TTFB is usually server, database, or cache — not file size. - **Author:** Willya Randika ([profile](/penulis/willya-randika)) ## Article **TTFB (Time to First Byte)** is the time from when the browser sends a request until the first byte of the response arrives. It measures how ready the server is, not how fast the whole page renders. ## What happens before the first byte 1. DNS lookup — turns the domain into an IP. 2. TCP connection and TLS handshake. 3. The server receives the request and runs PHP/the application. 4. The database is queried and the cache is checked. 5. The first byte is sent. High TTFB can therefore come from DNS, network, a busy server, a slow database query, or a cache miss. ## How to measure - **DevTools → Network → Timing** shows Waiting (TTFB). - `curl -o /dev/null -s -w "%{time_starttransfer}\n" https://example.com` gives a terminal TTFB number. - **WebPageTest** separates DNS, connect, TLS, and TTFB. A common target: below **0.8 s** is good, **0.8–1.8 s** needs improvement, and above **1.8 s** is poor. The number varies by location and network. ## What to watch for - **Cache can hide bad TTFB.** Test dynamic and cached pages separately. - **TTFB is not total load time.** A page can have low TTFB but high LCP because of heavy assets. - **The database is often the cause.** Slow queries, missing indexes, or a full connection pool. - **Server distance matters.** A CDN or a closer server location helps. - **PHP-FPM and OPcache** affect execution time; check [PHP-FPM](/en/hosting-wiki/php-fpm) and [OPcache](/en/hosting-wiki/opcache) when dynamic pages are slow. Test from more than one location before changing the theme or server. ## FAQ Below 0.8 seconds is good for many cases. Above 1.8 seconds usually feels slow, especially on mobile. No. TTFB only covers the first byte. The browser still downloads HTML, CSS, JS, and images afterward. For visitors far from the origin, usually yes. For visitors close to the origin, the difference can be small.