Latency
About 4 min read
Last updated: 2026-04-20
What Is Latency
Latency is the time it takes for data to travel from its source to its destination. Typically measured in milliseconds (ms), lower values indicate faster responsiveness.
When you type a URL into your browser, most of the "waiting time" before the page starts rendering is caused by latency. DNS resolution, TLS handshakes, server processing, and the physical propagation delay of data traveling back and forth all accumulate to create the perceived slowness.
Latency is often compared to the length of a water pipe. The time between turning the faucet and water coming out is latency, while the flow rate once water starts is bandwidth. No matter how wide the pipe (high bandwidth), if it is long, the first drop takes time to arrive.
How to Measure Latency
The most common tools for measuring latency are ping and traceroute.
ping example.com to see average, minimum, maximum RTT and packet loss rate.tracert on Windows or traceroute on macOS/Linux.Keep in mind that latency fluctuates significantly based on time of day and network congestion. Measure multiple times at different hours to get an accurate picture.
Latency vs. Bandwidth
Latency and bandwidth are frequently confused but measure entirely different things.
A speed test showing 1 Gbps download means nothing if latency is 200 ms - web pages will still feel slow. Conversely, 5 ms latency with only 1 Mbps bandwidth means large file downloads crawl. For real-time communication (gaming, video calls), latency is the dominant factor. For bulk transfers (streaming, backups), bandwidth matters more.
Latency Impact by Use Case
- Online Gaming: For FPS and real-time competitive games, under 20 ms is ideal. Above 50 ms, input lag becomes noticeable. Above 100 ms, competitive play is seriously impaired. Physical distance to game servers is the biggest factor, making CDN and edge servers valuable.
- Video Conferencing: Under 150 ms allows natural conversation. Above 300 ms, speech timing breaks down and turn-taking becomes difficult. Audio is more sensitive to latency than video.
- Video Streaming: Buffering masks latency during playback, but initial buffer time is affected. For live streaming, low latency directly impacts viewer experience.
- Web Browsing: Page loads involve multiple HTTP requests, so per-request latency compounds. HTTP/2 and HTTP/3 multiplexing mitigate this by allowing concurrent requests over a single connection.
How to Reduce Latency
Latency reduction requires both shortening physical distance and optimizing protocols.
- CDN: Serves content from edge servers close to users, minimizing physical propagation delay. Modern CDNs also cache dynamic content and accelerate API responses.
- Edge Computing: Runs computation near the user rather than in a distant data center. Cloudflare Workers and AWS Lambda@Edge are leading examples, eliminating round trips to origin servers.
- HTTP/3 (QUIC): A UDP-based protocol that combines TCP and TLS handshakes, reducing connection establishment round trips. Achieves 1-RTT on first connection and 0-RTT on reconnection.
- DNS Optimization: Using fast public DNS resolvers (Cloudflare 1.1.1.1, Google 8.8.8.8) reduces name resolution latency. DNS prefetching (
<link rel="dns-prefetch">) also helps. - Connection Prewarming:
<link rel="preconnect">completes DNS resolution, TCP connection, and TLS handshake in advance, reducing latency when the actual request is made.
Common Misconceptions
- Faster internet speed means lower latency
- Bandwidth (speed) and latency are independent metrics. A 1 Gbps fiber connection still has over 200 ms latency to a server on the other side of the globe. The speed of light imposes a physical limit that no amount of bandwidth can overcome.
- Latency is a server-side problem
- Latency accumulates across the entire path from client to server. Your Wi-Fi router's processing delay, ISP backbone congestion, undersea cable distance, and the number of routers traversed all contribute. Server response time is only one component.
- Low ping means all applications will perform well
- Ping measures ICMP round-trip time, but real applications use TCP/UDP with different packet sizes and communication patterns. Jitter (latency variation) and packet loss also significantly affect perceived quality, so ping alone does not fully evaluate connection quality.