Time To First Byte


Time To First Byte (TTFB) is the amount of time it takes for a web server to begin to respond to a request from a web browser and send the first byte of the requested page back to the browser.

This is an important measure of website performance, as it is the first step in delivering content. TTFB is measured in milliseconds and should be as low as possible. A slow TTFB can lead to poor browsing experience and slow page loads.

The TTFB is made up of many parts

Largest Contentful Paint

Before you can receive the first bytes from the server, your request first has to do DNS resolution (what is the IP address of the domain name), a connection has to be established with your server - and nowadays a secure connection has to be negotiated. Then the server starts processing your request. Once it's ready, it starts streaming the response. The TTFB metric is from the request is made until the first part of the response is being received.

A slow TTFB would be the first place to optimize because all other speed metrics depend on how fast the server responds.

What is a good TTFB?

Largest Contentful Paint

Google recommends that 75% of your traffic gets a TTFB of 800 ms or less.

What can I do to speed up the LCP?

  • Optimize caching. If you use WordPress or other CMS frameworks, make sure that requests can be cached and don't need round-trips to a database
  • Use a CDN on all your resources. Using a Content Delivery Network is a great idea, but make sure you include the HTML file itself.
  • Enable HTTP/3. And if your host doesn't allow this, at least use HTTP/2.
  • Try an edge function framework like Cloudflare Workers. In fact, PageVitals' entire web app is using Cloudflare Workers.

You can read a lot more on optimizing TTFB here.