If you have ever run a PageSpeed Insights test, you likely came across the following recommendation: “Reduce initial server response time”. The initial server response time affects the overall loading time and performance metrics such as the Largest Contentful Paint, one of the Core Web Vitals metrics. Therefore, it will also affect your PageSpeed score.
Reducing the initial server response time means that you should lower your site’s time to first byte (TTFB). TTFB refers to the amount of time it takes a browser to create a connection to the server and start downloading a web page’s contents. So, the more you can improve your TTFB, the better your performance will get.
Let’s understand what TTFB is and what causes a slow TTFB. You’ll find out how to reduce it and address the PSI recommendation. You’ll make your pages load faster and improve your LCP grade.
First, you can watch our video:
What is Time to First Byte (TTFB)?
“Time spent waiting for the initial response, also known as the Time To First Byte. This time captures the latency of a round trip to the server in addition to the time spent waiting for the server to deliver the response.”
To put it simply, TTFB is the amount of time from the moment you navigate to a web page to the moment it starts rendering – that is, the moment you’ll start seeing some content displayed on your screen.
TTFB is made up of three separate components:
1. The time it takes to send the HTTP request
TTFB starts with the HTTP request. The time it takes for a server to receive the request depends on the time it takes to perform a DNS lookup, the speed of the user’s network, the distance to the server, and any interruptions in the connection.
2. The time it takes to process the request
Once the server receives the request, it has to process it and generate a response. This involves starting processes, making database calls, running scripts, and communicating with other network systems.
3. The time it takes for the server to send back the first byte of the response to the browser
Finally, the server needs to send the response to the user. This step is dependent on both the network speed of the server and the user. If the user has a slow wifi connection, it’s going to affect the TTFB.
Basically, the longer it takes to send a request to the server, process it, and send it back to the user’s browser, the longer it takes to display your page to the user.
Why is TTFB Important?
TTFB is a factor that contributes to your overall page speed, so it’s an important metric to keep an eye on and optimize – also to improve your Core Web Vitals grades.
It’s also worth pointing out that you shouldn’t confuse TTFB with page speed. It’s simply a metric that gives you an idea of your site’s responsiveness.
TTFB is a metric that’s (mostly) within your control that you can tweak to speed up your site. So why not reduce it to make your site faster and get a better PageSpeed score?
What’s more, when you reduce TTFB:
- Users spend less time waiting for your site to start loading, improving the user experience – don’t forget that LCP is related to the Page Experience Update, the latest SEO ranking factor.
- Users are less likely to bounce while waiting for content to appear on the page, meaning higher engagement and retention.
What is a Good Time to First Byte (TTFB)?
If your TTFB is more than a few hundred milliseconds, there might be some bottlenecks on your server that you need to investigate.
Google recommends that sites should process user actions/inputs within 50ms to ensure a visible response within 100ms. For actions that take longer than 50ms to complete, always provide feedback, i.e., display a loading indicator or change the color for the active state.
What Causes a Slow TTFB?
When it comes to WordPress sites, several different factors can affect Time to First Byte:
- Network latency
- High web traffic
- Server configuration and performance
- Dynamic content
- DNS response time
There isn’t much you can do to solve high web traffic or network issues. But there are ways you can address server configuration, dynamic content, and DNS response times, which we’ll explore below.
How to Measure Time To First Byte: 4 Options
The first step to uncovering why your TTFB is time is high is to measure it. There are several ways you can measure TTFB, but keep in mind that each of the tools below will output different TTFB, so I recommend using the tool you’re more familiar and comfortable with.
1. Measuring TTFB with GTmetrix
You can easily measure TTFB with GTMetrix, which refers to this metric as “waiting” time.
To see your results, scan your site and open the waterfall. When you hover over the first result in the list, you’ll see your loading metrics, including wait time (aka TTFB).
2. Measuring TTFB with WebPageTest
You can also measure your TTFB with WebPageTest. When you scan your site, you’ll get your TTFB in seconds.
3. Measuring TTFB with Pingdom
Pingdom also measures TTFB, referring to it as “wait” time. To use this tool, simply scan your site and scroll down the results to the “File Requests” section, where you’ll see wait times for your site and individual requests.
4. Measuring TTFB with KeyCDN’s Web Performance Tool
Another fantastic tool for measuring TTFB is KeyCDN’s online Web Performance Test. It lets you quickly measure your TTFB from 14 different test locations. As you can see in the results below, the TTFB for the WordPress.org site is lower in the United States and higher in Europe, Asia, and Australia—proof that distance and latency play a big role in TTFB.
9 Ways to Reduce Time to First Byte (TTFB) on WordPress
Let’s look at how you can improve —therefore reduce— the TTFB and the server response times on WordPress.
1. Use a Fast Web Host
Using a fast web host that has a carefully thought-out architecture will go a long way to reducing your TTFB. Managed WordPress hosts configure their servers specifically for WordPress sites, so you can be confident your dynamic content is in good hands.
You must consider where your host’s servers are located. Choose a host that is located physically closer to where your users are. For example, if most of your users are located in Europe, it would make sense to host your site in Europe, not in the United States. (Although you can get around this with a CDN, which we’ll look at below.)
While you can’t control your site’s amount of traffic, you can manage your site’s scalability. So if you’re expecting high traffic to your site, ensure your host can scale your site quickly to improve its TTFB.
2. Use Caching
One of the easiest ways to decrease TTFB is to set up caching on your WordPress site. Caching helps decrease TTFB by helping reduce the server processing time.
Check with your web host to see what they offer as far as object caching does. Often, all you need to do is ask your host to enable it.
You can also enable WP Rocket to cache pages on your site, so your pages are delivered faster to returning site visitors. You’ll get the job done with no effort from your side. Once you enable WP Rocket, the plugin will do the job for you.
3. Use GZIP Compression
By applying GZIP compression, you’ll reduce the size of HTML, CSS, and JS files – all resources will download faster, and you’ll reduce the TTFB.
Check out your hosting provider: some hosts enable GZIP compression by default.
WP Rocket also applies GZIP compression on sites running on Apache – you only have the enable it!
As a free alternative, you can use a plugin such as Enable Gzip Compression.
4. Optimize Your Database
A database containing too much unnecessary data – such as posts revisions, trashed and spam comments, and temporary files created by plugins – will affect your server response time. You should optimize your database’s size and run regular cleanups.
WP Rocket gives you an easy way to optimize your database, reduce bloat, and schedule automatic cleanups.
You’ll find a dedicated tab including all the features, such as Post, Comments, and Automatic cleanup (daily, weekly, or monthly frequency):
5. Use a CDN
Using a good quality CDN like RocketCDN can help deliver your static content, like images and scripts, faster to users via a network of servers worldwide. This means that if your server is geographically located in Europe, for example, and your users are mostly in the United States, they will receive your site’s content from a server location that’s closer to them.
This reduces the network latency between your site’s server and your visitors.
For more on CDNs and choose the find one, check out How to Choose a CDN: Discover the Best CDNs for WordPress. You can also learn more about which benefits and advantages a CDN will offer.
6. Keep WordPress, Plugins, and Themes Updated
The WordPress core team and plugin and theme authors often add performance optimizations to their updates. Sometimes, this means they have optimized the queries that their code runs to the database or made updates that affect the PHP code’s efficiency.
It’s a best practice only to keep the plugins and themes you need and delete the rest. So regularly review your plugins and themes, and remove any that you’re no longer using.
The quality of your plugins can also impact your TTFB, so look out for plugins that are affecting your site’s performance. Broken Link Checker, for example, is designed to run in the background, checking for broken links every so often. The result is a slow WordPress admin and increased TTFB.
7. Reduce Queries
Often, the number of queries your site runs to get information from the database can affect TTFB. To help identify any query bottlenecks, try installing a diagnostic plugin like Query Monitor or consider a more heavy-duty tool like New Relic. The latter will help you dig into database queries that are the most time-consuming or have the slowest query time so you can find which plugins, themes, or settings are affecting your site’s page speed.
8. Use a Premium DNS Service
Typical hosting packages don’t offer premium DNS (although some managed WordPress hosts do). Investing in a premium DNS provider will ensure DNS queries are answered with low latency by using a global network of DNS servers, in turn helping to reduce your TTFB.
If you want to take this a step further, consider enabling DNS prefetching on your site. This technique lets you tell the browser to perform DNS lookups on a page in the background while the user is browsing. For more on this, check out Preload, Prefetch, Preconnect: How to Speed Up Your Site With Browser Resource Hints.
9. Don’t Forget the Latest Version of PHP
Using a 7+ PHP version will also improve your time to first byte. To give you a straightforward reason, PHP 7+ can handle almost 50% more requests per second. So, if you are still on PHP 5.6, it’s time for an upgrade!
Improve your Time to First Byte on WordPress Right Away
You could implement loads of other advanced techniques on your site to improve your TTFB, such as Disk IO, TLS overhead, reducing autoloaded data, and more. But the methods we’ve covered in this article are relatively simple to implement and will give you the biggest boost for your site’s performance.
WP Rocket is the easiest way to improve your TTFB and achieve outstanding speed improvements while stopping using different plugins to boost performance. And you don’t even have to touch the code!