Skip to content
pagespeed.tools

A server speed checklist: TTFB, redirects, compression and caching

Ten server and network checks that speed up every page on a site, from DNS and TLS 1.3 to Brotli, cache headers and HTTP/3, with a tool to test each one.

By . Published . 5-minute read.

DNS lookupConnectTLS setupServer waitDownloadFirst byte
On this page

Most speed advice is about the page: images, scripts, fonts. But before the browser sees any of that, it has to find your server, connect to it, set up encryption and wait for the HTML. On many sites that wait is the biggest single delay, and because it comes first, it slows down every other measure, including Largest Contentful Paint.

The good news is that server and network fixes are often settings rather than code. Work through this list in order; each item names a free tool on this site that checks it. Or run the website speed test to check most of them at once.

1. Know your time to first byte

Time to first byte (TTFB) is the time from requesting a page to receiving the first byte of the response. Google's guidance treats 0.8 seconds or less as good and more than 1.8 seconds as poor, measured for real visitors. It is not a Core Web Vital itself, but a slow TTFB makes a good LCP very hard to reach.

The TTFB test splits the time into DNS lookup, connecting, encryption and the server's own work, which tells you which of the following items to focus on.

2. Remove redirect chains

Each redirect is a full extra round trip before the page starts loading. A link to http://example.com that redirects to https://example.com, then to https://www.example.com, then to the page with a trailing slash, can add half a second on a mobile connection.

Make every redirect go straight to the final address in a single hop, and update internal links, canonical tags and sitemaps so they point at final addresses. The redirect checker lists every hop with its status code and time.

3. Use a fast DNS provider

Before connecting, the browser has to turn your domain into an IP address. A slow or distant DNS provider adds delay to every first visit. Managed DNS from a large provider is usually fast everywhere. Avoid very short time-to-live values on stable records, because they force more lookups. The DNS lookup shows your records, their time to live and how long a lookup takes.

4. Serve from close to your visitors

Connection setup takes several round trips, and each round trip is limited by distance. A visitor in Sydney connecting to a server in Frankfurt waits for every one of them. A content delivery network (CDN) answers from a location near each visitor. Even if your HTML cannot be cached, the connection to a nearby CDN location is faster, and the CDN keeps a warm connection back to your server.

5. Use TLS 1.3

Every HTTPS connection starts with a TLS handshake. TLS 1.3 needs one round trip where TLS 1.2 needs two, so it saves a noticeable chunk of time on slow or distant connections. Most modern servers and CDNs support it; it may just need enabling. The SSL checker shows the TLS version, the certificate's issuer and when it expires.

6. Turn on HTTP/2 and HTTP/3

HTTP/1.1 sends one request at a time per connection, so browsers queue requests. HTTP/2 sends many requests over a single connection at once. HTTP/3 does the same over QUIC, which copes better with lost packets and changing networks, a common situation on phones.

Both require HTTPS. Most CDNs offer them with a single setting. The HTTP/2 and HTTP/3 test shows what your server supports and whether it advertises HTTP/3 to browsers.

7. Compress text responses

HTML, CSS, JavaScript, JSON and SVG compress extremely well, often to a fifth of their size or less. Make sure the server compresses them, preferably with Brotli, which usually beats Gzip on text, with Gzip as a fallback for older clients. Do not compress images, video or WOFF2 fonts: they are already compressed.

The Gzip and Brotli test shows which method your server uses and how many bytes it saves.

8. Set cache headers deliberately

Caching saves the most time of all: a file that is already stored does not travel again. Set Cache-Control on purpose for each kind of file:

WhatSuggested headerWhy
Files with a version or hash in their name (scripts, styles, fonts, images)public, max-age=31536000, immutableThe name changes when the content does, so a year is safe
HTML pages that are the same for everyonepublic, max-age=0, s-maxage=300, stale-while-revalidate=86400Browsers recheck; the CDN serves a fresh-enough copy instantly
Personalised pagesprivate, no-cacheOnly the visitor's own browser may keep it, and it must recheck

The cache checker reads these headers for any address and shows whether a CDN answered from its cache.

9. Cache the HTML itself

If TTFB is still slow after the network items above, the server is spending too long building the page. Look at the slowest database queries and external API calls in the request. Better still, avoid the work: render pages that are the same for everyone once, then serve the stored copy from a CDN or an application cache, and refresh it in the background.

10. Keep the HTML lean

The HTML is the one file the browser must download before it can do anything else. Very large inline scripts, styles or data islands make it slow to download and parse. Keep the HTML focused on the content, and load the rest as separate cacheable files. The page size checker measures the HTML and counts the render-blocking files in the page head.

Then measure what visitors get

Lab checks like these run from one place. Real visitors connect from everywhere, on every kind of network. Once you have worked through the list, look up your site's field data on pagespeed.tools and watch TTFB and LCP over the following weeks.

For the page-level work that comes after the server, see our guides to Largest Contentful Paint, Interaction to Next Paint and Cumulative Layout Shift.

Check it on your own site

Written by

Abdessamad Bettal

Web developer and the builder of pagespeed.tools: free tools for finding what slows a website down and fixing it.

More guides