Time to first byte is the duration between the start of a request, and when the browser first receives data from the web server. If you're looking to improve your web site's page speed, then improving TTFB is a great place to start. There are many reasons for time-to-first-byte to be less than ideal. We'll cover the most common reasons for slow TTFB and how to improve it.
Simply put, TTFB measures how long it takes for the server to start responding. It's measured from the instant the browser begin loading a file, to when starts receiving data. This metric includes network latency, DNS lookup, the SSL handshake, and the server's processing of the request.
When the browser requests any resource, there are a few different parts of this process before it starts receiving the file.
All of these steps are counted in the total TTFB metric. Most of this you don't have any control over, however, you can reduce how long it takes for the server to process the request, and reduce latency between the client and server.
There are various free page speed testing tools you can use online to measure TTFB. You can simply enter your website URL, and these tools will report back lots of useful information. We'll go over some of them below.
GTMetrix is a good tool for testing page speed in general, and it also reports a time to first byte metric. While this tool isn't the best for measuring overall speed, and its letter grade is overly optimistic, it's great for checking how your changes have improved TTFB. Running speed tests with PageSpeed Insights will give you better overall results, but less detailed data for diagnosing issues.
WebPageTest is another general tool for testing lots of metrics related to pagespeed. It reports TTFB, as well as lots of other things, and is a great tool for diagnosing all pagespeed issues. You can choose between various devices and connection speeds, to see how your site performs under various conditions.
Byte Check is a tool dedicated to measuring TTFB. It will break down how long DNS lookup times are, SSL handshake times, and server processing. If you're looking for a simple app to quickly check TTFB, then this is it.
The developer tools in Google Chrome also report TTFB. This is a good way to test time to first byte on your own computer. Keep in mind that TTFB will vary depending on geographical location, so even if from your machine it looks low, you should consider setting up a CDN for fast asset delivery to users located around the globe.
Time to first byte adds to the total load load of your pages. As the server processes requests from a user's browser, they'll see a blank page, regardless of the speed of their internet connection.
TTFB is important because it directly impacts your pagespeed. If you're doing SEO, then this matters because of Google's Core Web vitals. Google measures your page loads, and uses speed as a direct ranking factor to influence search rankings. Not only that, but bounce rate and loading times have a directly correlation, and bounce rate is another ranking factor.
Even if you're not doing SEO, then site speed is important. For example, if you're running paid traffic, then every user who clicks your ad and gets tired of waiting for the page to load is money wasted. For any traffic source, you're going to want to make the most of all of your website's visitors.
If you're using a CMS like WordPress, then the server processing time may be slowing your TTFB down. Most web pages do not change on every request, and do not need to be treated as dynamic content. By using a cache plugin, your the HTML of your WordPress site will be saved as static content, and served to user without requiring the webpage to be regenerated.
Even with caching enabled, and with a fast and properly configured web server, a content delivery network can greatly reduce server response times. Since data center location relative to the user will impact server response time, a CDN makes sure your files are always stored geographically close to the user.
A CDN can also reduce network latency even when users are located near the physical server. For example, when you use Cloudflare's CDN, fewer network hops are usually required to reach the server. Cloudflare, and other CDNs, have fast direct connections to ISP equipment, so users can access your files faster. With Cloudflare, you can even see a low TTFB around 50ms.
Make sure your web server or host isn't slowing your site down. On some shared hosting plans, the server hardware is too weak to support the sites running on it very well. Rather than using a shared host, it's best to use a VPS provider like DigitalOcean, or use optimized WordPress hosting such as Kinsta or WP Engine. While a CDN can make up for this, it's best to keep your website's TTFB at a server level fast too.
There are some server configuration issues that may cause a slower TTFB. You should make sure that the canonical versions of your URLs never redirect, and that you're always linking to canonical versions of resources. Each additional redirect is another request, and will slow down the load. If you're using complex firewall rules then this can increase how long it takes for the server to respond.
Improving time to first byte is an easy step you can take to improve your site's overall performance. Slow pages will drive users away, so the faster your site, the more users engage with your site, and the more leads, sales, conversions, or affiliate link clicks you'll get.
At Fastify, we've worked to perfect pagespeed. Check out the rest of our free resources to learn how you can speed up your site too. We also offer a step-by-step course that will show you exactly how to optimize your pages to make them as fast as possible.