DNS Caching Flow
DNS caching is the multi-layer mechanism that stores resolved DNS records at various points in the resolution chain to avoid redundant upstream queries and reduce latency for repeated lookups.
DNS caching is the multi-layer mechanism that stores resolved DNS records at various points in the resolution chain to avoid redundant upstream queries and reduce latency for repeated lookups.
Every DNS record has a TTL (Time to Live) value set by the domain owner. This integer (in seconds) tells each caching layer how long it may serve the cached record before discarding it and re-querying. A TTL of 300 means any cache must re-validate after 5 minutes; a TTL of 86400 allows caching for 24 hours.
The caching hierarchy operates from closest to farthest:
Browser cache is the first stop. Modern browsers like Chrome and Firefox maintain their own DNS cache in memory. Chrome exposes this at chrome://net-internals/#dns. These caches respect the TTL but may impose their own caps (Chrome caps positive entries at 1 minute by default).
Operating system cache (the OS stub resolver) is next. On macOS this is handled by mDNSResponder; on Linux by systemd-resolved or nscd. Applications that bypass the browser use this layer directly via getaddrinfo().
Recursive resolver cache is maintained by your ISP's resolver or a public resolver (Google 8.8.8.8, Cloudflare 1.1.1.1). This is shared across all users of that resolver, so popular domains are almost always served from cache at this layer — dramatically reducing load on authoritative servers.
Authoritative server is only reached on a true cache miss at every layer. The response resets TTL timers throughout the chain.
For developers, this layered caching explains why DNS changes seem "slow" — you must wait for TTLs to expire at every layer independently. Lowering TTL before a planned DNS migration (e.g., from 3600 to 60 seconds) is a standard pre-migration practice. See How DNS Works for the full lookup flow and DNS Recursive Resolution for the resolver's role.