Applies to: curl on Linux, macOS and Windows 10 and 11
TTFB (time to first byte) is how long a server takes to start sending a page after the request. It shows server and hosting speed separately from images, scripts and the visitor’s browser. curl measures it, and every other step of the connection, in one command.
Measure one page
curl -s -o /dev/null -w "dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s ttfb %{time_starttransfer}s total %{time_total}s http %{http_code}\n" https://example.com/
Three runs against our own home page printed a TTFB of 0.846, 0.097 and 0.102 seconds; a typical line was dns 0.005s connect 0.027s tls 0.059s ttfb 0.097s total 0.162s http 200. The first request was slower because the page wasn’t cached yet, which is why one measurement is never enough. On Windows, use curl.exe in PowerShell and NUL instead of /dev/null.
What the numbers mean
- dns: looking up the domain. High values point to slow DNS.
- connect: the network round trip to the server; depends mostly on distance.
- tls: the HTTPS handshake finished.
- ttfb: the server has produced the first byte of the page. The gap between tls and ttfb is your server and application time.
- total: the whole HTML page downloaded.
Is it good?
Google’s web.dev guidance says most sites should aim for a TTFB of 0.8 seconds or less, measured from the visitor, so including the network time. Run the test several times, and from places near your visitors.
Common causes of a slow TTFB
- No page caching for WordPress or another CMS.
- Slow database queries or a heavy plugin.
- Too little CPU or memory on the hosting plan.
- A server far from your visitors (see how to find your server’s location).
For a full picture including images and scripts, also run the page through Google PageSpeed Insights. If the server is the bottleneck, compare our KVM VPS plans or ask our engineers to tune it.