Skip to content
ENExplore Calculators

API Response Latency Calculator

Break an API response into DNS, TCP, TLS, server and transfer time, then project the p95 and p99 tail.

About API Response Latency Calculator

A cold request pays DNS, then one round trip for TCP, then one or two more for TLS, before the request itself makes a round trip and the server does its work. Decomposing it this way shows which term actually dominates, and the p95/p99 multiples project the tail that users complain about but averages hide. Optimising the wrong term is the most common latency mistake — shaving 20 ms of server time is pointless when the client is spending 96 ms on handshakes it could have skipped by reusing a connection or terminating TLS at the edge.

Formula

API Response Latency

response = DNS + TCP (1 RTT) + TLS (RTT × handshake round trips) + request RTT + server processing + body ÷ throughput; a reused connection zeroes the first three terms.

RTT
Round-trip time between client and endpoint
handshake round trips
0 for a resumed session, 1 for TLS 1.3, 2 for TLS 1.2
transfer time
Response body size divided by the client's usable throughput

Worked example

With the default values below, API Response Latency Calculator returns Median Response Time of 310.80. Change any input above and every figure here is recalculated in your browser.

Inputs used

DNS resolutionaccepts 0–10,000 ms
18 ms
Round-trip time to the endpointaccepts 0–10,000 ms
32 ms
TLS handshake costone of Resumed session or 0-RTT (no extra round trip), TLS 1.3 full handshake (1 round trip), TLS 1.2 full handshake (2 round trips)
TLS 1.3 full handshake (1 round trip)
Server processing timeaccepts 0–120,000 ms
120 ms
Response body sizeaccepts 0–1,000,000 KB
240 KB
Effective client throughputaccepts 0.01–100,000 Mbps
25 Mbps
Connection already established
No
p95 multiple of the medianaccepts 1–20 ×
2.2 ×
p99 multiple of the medianaccepts 1–50 ×
4.5 ×

Results

Median Response Time
310.80 ms
Time to First Byte
234.00 ms
Connection Setup Time
82.00 ms
Content Transfer Time
76.80 ms
95th-Percentile Response Time
683.76 ms
99th-Percentile Response Time
1,398.60 ms
Saving From Reusing the Connection
82.00 ms
Dominant Term
Server processing — cache the response or optimise the handler

Step by step

  1. 1Values used
  2. 2API Response Latency
  3. 3Median Response Time= 310.80 ms
  4. 4Time to First Byte= 234.00 ms
  5. 5Connection Setup Time= 82.00 ms
  6. 6Content Transfer Time= 76.80 ms
  7. 795th-Percentile Response Time= 683.76 ms
  8. 899th-Percentile Response Time= 1,398.60 ms

Assumptions and limits

  • The result is derived only from the 9 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How is API Response Latency calculated?

response = DNS + TCP (1 RTT) + TLS (RTT × handshake round trips) + request RTT + server processing + body ÷ throughput; a reused connection zeroes the first three terms. A cold request pays DNS, then one round trip for TCP, then one or two more for TLS, before the request itself makes a round trip and the server does its work. Decomposing it this way shows which term actually dominates, and the p95/p99 multiples project the tail that users complain about but averages hide.

Why does API Response Latency matter?

Optimising the wrong term is the most common latency mistake — shaving 20 ms of server time is pointless when the client is spending 96 ms on handshakes it could have skipped by reusing a connection or terminating TLS at the edge.

What values do I need to enter?

This calculator takes 9 inputs: DNS resolution, Round-trip time to the endpoint, TLS handshake cost, Server processing time, Response body size, Effective client throughput, Connection already established, p95 multiple of the median, p99 multiple of the median. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

Why report p95 and p99 rather than the mean?

The mean is dragged down by fast cache hits and hides the slow tail. If 1% of requests take five times as long, a user making a hundred calls to render one page almost certainly hits it — so the p99, not the average, is what the page actually feels like.

API Response Latency Calculator | Calcrivo