Time to First Byte (TTFB)

The server sends the first byte of content within 0.8 seconds.

On this page

Impact

ScanGov impact ratings

About

Time to First Byte (TTFB) measures the time it takes from when a browser requests a resource to when the first byte of data begins to load. It's an important metric for website performance, affecting how quickly a page appears. A good TTFB is under 0.8 seconds, and anything over 1.8 seconds needs improvement. TTFB is influenced by server responsiveness and connection setup time. Lowering it can improve overall user experience and speed.

Risks

Slow server delays everything on your page.

Why it's important

Measures how quickly a server responds, impacting page load speed and user experience by reducing wait times.

User stories

As a user requesting a web page, I want the server to respond quickly so that the page starts loading without noticeable delay.

Code

nginx — enable gzip compression and caching to reduce TTFB:

gzip on;
gzip_types text/plain text/css application/json application/javascript;

location ~* \.(css|js|png|jpg|svg|woff2)$ {
  expires 1y;
  add_header Cache-Control "public, immutable";
}

Error

ScanGov messaging when a site fails a standard:

Server response took over 0.8 seconds.

Guidance

Demo

Indicators

On this page