Sticky Banner Visual Mobile 3

Spring deal: Get a free upgrade for 3 months on annual offers.

Spring deal: Free upgrade on annual offers. Claim now!

Claim Now!

Expressvpn Glossary

DNS cache

DNS cache

What is a DNS cache?

A Domain Name System (DNS) cache is a temporary database that stores DNS records in a browser, OS, router, or recursive DNS server to skip the full DNS lookup process. This reduces loading time on repeat site visits and reduces traffic on the network.

Where is the DNS cache stored?

DNS records, including the IP addresses of recently visited domains, are stored in local and network-level caches:

  • Browser DNS cache: Web browsers (e.g., Chrome, Firefox) may maintain their own internal cache to resolve requests quickly.
  • OS DNS cache: The OS (e.g., Windows, macOS, Linux) keeps a DNS resolver cache that stores the results of the last lookups.
  • Router DNS cache: A local network router may cache DNS answers if it runs a DNS forwarder or resolver for the network.
  • Recursive DNS server cache: An internet service provider (ISP) or a public DNS provider (e.g., Google, Cloudflare) maintains a cache to speed up requests for its entire user base.

How does a DNS cache work?

The DNS caching process follows a hierarchical sequence to connect to a website:The sequential DNS lookup process, moving from local caches in the browser, OS, and router to external resolvers and authoritative servers

  1. Initial DNS query: The device sends an initial query to find the corresponding DNS record when a user enters a domain name into a browser or opens a link.
  2. Local cache check: The system checks the browser's cache for the DNS record. If it’s not found, it checks the OS cache, then the router's cache. If the record is found in any of these local caches, the website loads immediately.
  3. Recursive DNS server check: If the record isn’t found in local caches, the request moves to the recursive DNS resolver.
  4. Authoritative DNS server check: If the record isn’t in the recursive DNS server, it performs a full DNS lookup by contacting the authoritative DNS server to get the correct domain details.
  5. Retrieval and storage: The DNS record is sent back to the requesting device to load the page. As it travels, it’s saved at each cache level with a time-to-live (TTL) value that determines how long the record is stored.

DNS cache benefits and limitations

The primary advantages of DNS caching include faster website loading times, reduced network traffic, and improved reliability if external DNS servers become temporarily unavailable. By resolving requests locally or through a nearby DNS server, the system minimizes latency and load on authoritative servers.

However, DNS cache can sometimes store corrupted or outdated information if a website changes its IP address before the TTL expires. Caches can also face security risks like DNS cache poisoning, where attackers insert malicious data to redirect traffic to harmful sites.

Further reading

FAQ

What is the purpose of DNS caching?

Domain Name System (DNS) caching temporarily stores DNS records (e.g., IP addresses) of recently visited sites, making it faster and more efficient to retrieve content in the future.

What is the primary benefit of DNS caching?

The primary benefit of Domain Name System (DNS) caching is faster website loading, as it reduces DNS lookup times for frequently visited websites.

What information is stored in a DNS cache?

A Domain Name System (DNS) cache contains DNS records of previously visited domain names. This includes A, AAAA, CNAME, TXT, and other types of records.

What causes DNS cache corruption?

Corruption can occur due to technical glitches, software crashes, or malicious attacks such as Domain Name System (DNS) cache poisoning, where malicious data is injected into the cache.
Get Started