How does webpagetest determine if TTFB grade

Hello ,
How does webpagetest determine the TTFB? Is there some kind of formula base on the number of requests etc?


The TTFB is for the base HTML and is measured from the start of the overall navigation.

WebPagetest uses the socket connect time for the base page as an estimate for the round-trip time to the server. It then takes the DNS time, socket connect time, SSL time and adds on one additional round trip as it’s estimate for the fastest possible TTFB and then allows for 100ms on top of that.

Anything beyond the target TTFB time will lose a letter grade for each 100ms.

oh, and as far as MEASURING the TTFB, it’s just the time when the first byte of the base page (after any redirects) arrives from the beginning of the test.

What is checked —> The target time is the time needed for the DNS, socket and SSL negotiations + 100ms. A single letter grade will be deducted for every 100ms beyond the target.

Let me know if this is correct:

Start Offset: 0.111 s
DNS Lookup: 53 ms
Initial Connection: 57 ms
Time to First Byte: 517 ms

Total: 628 ms
Target —>
DNS lookup (53 ms) + Initial Connection (57 ms) + 100 ms = 208 ms

But webpagetest is saying the target is “171 ms Target First Byte Time”.

Thoughts how how the target is calculated from the report above?



Hmm - apparently there is a bug somewhere in the calculation that I need to track down.

Should be:
DNS Lookup (53ms) + Initial Connect (57ms) + 1 round trip (57ms) = 167ms (and then a 100ms allowance before a grade reduction). Could be that the difference between 167 and 171 is some gap time between the individual steps

Assuming you fix the bug, the target is 171 ms, and if the TTFB is 271, then it’s graded a A or B? If A, then at 371 it would be graded a B.

Let me know.


171-270ms would be an A, 271-370 B, etc. So as long as the server time was < 100ms it would get an A.


Hi, I know this is an old thread but I wanted to revive it because I had a question about calculating the First Byte Time score if using the API.

When looking at a response from the API, it looks like DNS Lookup is available via dns_lookups. And TTFB is available via time_to_first_byte_ms. But I don’t see how I can get Initial Connection or Start Offset. Are these unavailable via the API or am I just missing some way to access them? I could not find anything about them in the documentation here:

Thanks for your help.

dns_lookups is a count, not the timing. if you want the timings for individual components you need to look at the request timings. At the top level there is a server RTT which is the socket connect time to the origin for the base page which is used in the grade calculation.