What Is a DNS Cache?
A DNS cache is a small, temporary record of domain names a device has recently looked up, along with the addresses they resolved to, so the device can skip asking a DNS server again. DNS itself, the Domain Name System, does the translating: you type example.com, and it returns the numeric IP address your computer connects to.
Each cached entry holds three things:
The domain name: The name that was requested.
The answer: Usually the IP address that name points to.
An expiry timer: How long the answer can be reused before it must be checked again.
Take a common case. An employee who opens the company intranet first thing in the morning triggers a lookup, because the laptop has no stored address for it yet. Every later visit that day is answered from the laptop's memory until the timer runs out.
DNS caches exist on laptops, in browsers, on office routers, on internal DNS servers such as a domain controller, and on the DNS servers run by internet providers.
How Does DNS Caching Work?
DNS caching works by checking the closest cache first and asking further out only when no valid answer is stored. A lookup follows these steps:
The browser checks its own cache.
The operating system checks its cache and the hosts file, a local text file that can map names to addresses by hand.
The request goes to a recursive resolver, the DNS server that finds answers on the device's behalf, which checks its own cache.
If nothing is cached, the resolver asks the authoritative server, the server that holds the official records for that domain, and stores the answer on its way back.
Every extra step adds latency. A browser that already knows the address can connect straight away; one that has to query a distant server waits for the round trip.
How long entries last: Each record also carries a TTL (time to live), a number of seconds chosen by whoever owns the domain. When it runs out, the stored copy is thrown away. The next request for that name goes all the way out again.
Failed lookups are cached too: A "no such domain" reply gets stored for a short time, which stops the resolver from repeating a lookup that is bound to fail. This is called negative caching.
How Long Does DNS Cache Last?
DNS cache lasts for whatever TTL the record carries, and that might be a few seconds, a day, or longer. Since each domain owner sets its own value, two sites you open a minute apart can stay cached for periods that differ by hours.
Short TTLs: Fit records that change often, such as failover or load-balanced addresses, since clients pick up the change quickly.
Long TTLs: Fit stable records and cut the number of lookups that reach the DNS server.
Local limits: Browsers and operating systems often apply their own upper limit, so a local copy can expire before the record's TTL does.
Planning a server move to a new IP address? Lower the TTL in advance, at least as far ahead as the current TTL, so every cached copy of the old value has expired by migration day. After the switch, users reach the new address within minutes, and the TTL can go back up once the move is confirmed.
Where Is DNS Cache Stored?
DNS cache is stored in more than one place. Each location holds a separate copy, and each copy runs on its own timer.
Cache location | Who uses it | How to clear it |
Browser | That browser only | From the browser's internal settings page |
Operating system | Every application on the device | With a command on the device |
Office router | Every device on that local network | By restarting the router or its DNS service |
Internal DNS server | Every device using that server, including private DNS zones | By an administrator on the server |
Internet provider or public resolver | Every customer using that resolver | By the provider, or through a public flush form |
Clearing one layer leaves the others untouched, since they don't expire together. That explains a common support case: the fix works on one laptop, then fails on the one beside it.
Why Is DNS Caching Important?
DNS caching is important because nearly every connection begins with a name lookup, and a cached answer means that step costs almost nothing in time. The main benefits are:
Faster responses: Cached answers return almost instantly, so pages and API calls start sooner.
Less load on DNS servers: Fewer requests reach internal and external DNS servers.
Lower network traffic: Repeat lookups stay on the device or local network, which reduces bandwidth consumption.
Short-term protection from outages: A cached answer keeps working while a DNS server is briefly unreachable.
What Problems Can DNS Cache Cause?
DNS cache problems happen when a stored answer no longer matches the official record. The three common causes are:
Stale records: A service moves to a new IP address, but devices keep connecting to the old one until the TTL expires.
Cache poisoning: An attacker plants a false record so users are sent to a malicious address. DNSSEC, a security extension that digitally signs DNS records, lets resolvers reject forged answers.
Corrupted local cache: Windows may show the message "There's a problem with the DNS cache" when the local cache or network settings are damaged.
Signs of a DNS cache problem:
One user reaches the old server while a colleague reaches the new one.
A service fails by name but responds when you use its IP address.
An outage continues after the fix has already been applied.
Checking each cache layer in order during network troubleshooting shows which one still holds the wrong answer.
How Can You View DNS Cache?
You can view DNS cache with a command on most operating systems, which helps confirm whether a stale entry exists before you clear anything.
Platform | Command | What it shows |
Windows | ipconfig /displaydns | Every cached name, its record and remaining TTL |
Windows PowerShell | Get-DnsClientCache | The same list in a sortable table |
macOS | sudo killall -INFO mDNSResponder | Writes cache contents to the system log, viewable in Console |
Ubuntu and systemd Linux | resolvectl statistics | Cache size and how often lookups hit the cache |
Chrome and Edge | chrome://net-internals/#dns | Lets you look up how the browser resolves a single name |
How Do You Flush DNS Cache?
You flush DNS cache by running the clear command for the layer that holds the wrong answer. Run these with administrator rights.
Platform | Command | What it does |
Windows | ipconfig /flushdns | Clears the Windows DNS cache |
macOS | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | Clears the cache and restarts the DNS service |
Ubuntu and systemd Linux | sudo resolvectl flush-caches | Clears the systemd-resolved cache |
Linux with nscd | sudo systemctl restart nscd | Restarts the name service cache |
Chrome and Edge | chrome://net-internals/#dns, then Clear host cache | Clears the browser's DNS cache |
Firefox | about:networking#dns, then Clear DNS Cache | Clears the browser's DNS cache |
Clearing a DNS server's cache: Flushing a laptop leaves the DNS server's copy in place. Server-side clearing on Windows Server is done with Clear-DnsServerCache in PowerShell; older setups still accept dnscmd /clearcache. Some public DNS providers go a step further and let anyone request a refresh of one domain's cached record through a web form.
Check the hosts file too: If the hosts file still lists an old address for a name, the device skips DNS for that name entirely. Delete that line, then flush again.
How Do You Fix "There's a Problem with the DNS Cache" on Windows?
The "There's a problem with the DNS cache" error usually clears once you flush the cache and reset a few Windows network settings. Open Command Prompt as an administrator and run these commands in order:
Command | What it does |
ipconfig /flushdns | Clears the DNS cache |
ipconfig /registerdns | Re-registers the device with its DNS server |
ipconfig /release | Drops the current IP address |
ipconfig /renew | Requests a new IP address |
netsh winsock reset | Resets the Windows network socket settings |
netsh int ip reset | Resets the TCP/IP settings |
Then restart the PC. If the error returns, check for a manual proxy setting under Internet Options, then LAN Settings, and remove it.
Is It Good to Clear DNS Cache?
Clearing DNS cache is safe and useful in three situations:
A website or service is not loading correctly.
A DNS record has just changed.
Cache poisoning is suspected.
It deletes nothing permanent, and the cache rebuilds with fresh answers on the next lookups. Clearing it on a fixed schedule adds little, because the first requests afterwards take slightly longer. When the same cache issue keeps coming back, the fault is usually in configuration, so a root cause analysis is the better use of time. Good places to start are overly long TTLs, a misconfigured DNS forwarder and a resolver in poor health.
How Does Monitoring Help Manage DNS Cache Issues?
Monitoring helps manage DNS cache issues by warning IT the moment lookups slow down, start failing or come back with an unexpected address, often before the first user ticket arrives. An observability platform can track:
Lookup time: How long each DNS server takes to answer, measured from the offices and sites users work from.
Record accuracy: Whether each critical record still returns the expected IP address, which flags stale or poisoned entries early.
DNS server health: Availability, query errors and failed lookups on internal DNS servers.
Network path: Packet loss and delay between users and each DNS server.
Put these DNS metrics next to server, network and application data, and it becomes clear whether a slowdown started in the cache, on the DNS server or somewhere along the network path. Anomaly detection covers what fixed thresholds can't: a lookup time that creeps up slowly over days.
Explore More IT Terms
Browse our comprehensive IT glossary to learn more about technology terminology.