1. blog/
  2. Cybersecurity and Internet Protection/
  3. What Is DNS Cache? How to Flush Your DNS Cache on Any Operating System

What Is DNS Cache? How to Flush Your DNS Cache on Any Operating System

Ever wondered why a website loads faster the second time you open it? Part of the answer is your DNS cache. So what is DNS cache, exactly? It’s a small store of recent lookups your device keeps so it doesn’t have to ask the internet for the same address twice.

Understanding what is DNS cache helps you fix slow or broken sites, clear out old records after a site moves, and spot when something has gone wrong with your connection. This guide breaks it down in plain language — and walks you through clearing it on any device.

What Is a DNS Cache and How Does It Work?

Every website has a name you can read, like example.com, and a number the network actually uses, called an IP address. The domain name system is the phonebook that translates one into the other.

A DNS cache is temporary storage that keeps the results of recent lookups. When your device resolves a domain, it saves the answer for a short while. The next time you visit, it reads from local cache instead of starting a fresh DNS lookup.

This DNS cache stores each domain next to its matching IP address, plus a countdown timer. We’ll get to that timer in a moment.

Caching happens in more than one place. Your browser keeps its own store, your operating system or browser keeps one, and your internet service provider runs a recursive DNS server that caches answers for many users at once.

How the DNS Lookup Process Uses the Cache

Here’s the DNS lookup process, step by step:

  1. You type a domain into your browser.
  2. It checks its own cache for a match.
  3. If it finds nothing, the request passes to your system, which checks the system cache and the hosts file.
  4. Still no match? The query goes to a recursive resolver — usually run by your internet service provider or a public DNS service.
  5. That server asks the wider DNS infrastructure: root servers, the TLD server, and finally the authoritative server that holds the real DNS record.
  6. The authoritative name server returns the answer. Every server along the path saves it, and the DNS response reaches your device.

Once that DNS information is stored in the cache, subsequent requests skip most of these steps. That’s why the second visit feels quicker — fewer DNS queries and web pages load faster.

Each DNS record carries a time-to-live value, also written time to live. TTL values tell every cache how many seconds to hold the answer before it expires. When the original TTL value runs out, the server fetches a fresh DNS answer from the source. That timer is why DNS responses aren’t kept forever.

If you want a deeper look at how addresses move across the network, our guide on how the internet works with addresses covers the basics.

Why and When to Flush the DNS Cache

Most of the time, caching mechanisms work quietly in the background and you never think about them. But a few situations call for a manual reset.

A site recently changed servers. When a domain moves to a new address, the old entry can linger in your local cache until that timer expires. Flushing forces your device to pull the new DNS record right away.

You see connection issues. If a page won’t load but works on your phone’s mobile data, a stale entry may be the cause. Clearing it is a common troubleshooting step for a broken network connection.

DNS changes haven’t propagated. After a site owner updates its nameservers, it takes time for the change to propagate across the internet. This skips your local wait.

Privacy housekeeping. Your cache is a list of visited sites. Clearing it removes that local trail. More on that below.

How to Flush Your DNS Cache on Any Operating System

Flushing the cache takes one command on most systems. Here’s how it works, depending on your OS.

Windows. Open Command Prompt as administrator and run: ipconfig /flushdns You’ll see a note confirming the flush cache action succeeded.

macOS. Open Terminal and run: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder Enter your password when asked.

Linux. The command depends on your distro. For systemd, run sudo systemd-resolve --flush-caches.

Chrome browser. Chrome keeps its own DNS client store during web browsing. Type chrome://net-internals/#dns into the address bar and select Clear host cache to flush DNS cache inside the browser.

After you flush the cache, your next request rebuilds the store from scratch with current records. If you ever need to clear the DNS cache on a schedule, the same commands work fine in a script.

Need to update the address your device shows to the world too? See our walkthrough on how to change your IP address without a VPN.

DNS Cache Poisoning and Other Security Risks

A cache is useful, but it can also be a target. DNS poisoning — sometimes called cache poisoning — is an attack where someone slips a fake record into a DNS server’s store. The corresponding IP addresses now point to a malicious server instead of the real one, even though the domain name looks normal.

Because the bad entry sits stored in the cache, every user of that recursive resolver can be sent to the wrong place until the record expires. Clearing the local cache removes a poisoned entry from your own machine.

Good defenses go beyond a manual reset. DNS filtering blocks known-bad domains before they resolve. Threat intelligence feeds keep those block lists current. And encrypting your DNS traffic stops outsiders from reading or tampering with your DNS requests as they cross the network.

Attackers also lean on the same system for other tricks. DDoS attacks that flood nameservers, for example, aim to raise server load until legitimate DNS resolution slows to a crawl. A well-run DNS infrastructure spreads that network traffic across many servers to reduce load and stay reachable.

Want to check what your device is actually resolving right now? Planet VPN’s DNS leak test shows which resolver is answering your queries.

Keep Your DNS Traffic Private with Planet VPN

Flushing your cache fixes stale records, but it doesn’t hide which sites you look up. Every query you send in the clear can be read by your internet service provider — and anyone else on the path.

Planet VPN encrypts your connection so your DNS traffic travels through a protected tunnel, not your ISP’s open server. Core protection is free, forever — no credit card, no trial clock. Premium adds more locations and more speed when you want them.

Get started with Planet VPN free or compare Free and Premium plans.

Frequently Asked Questions (FAQs)

Is it safe to clear DNS cache?

Yes. Clearing the cache is safe and reversible. It only removes stored lookup results — no personal files, settings, or saved passwords are touched. Your device simply rebuilds the store with fresh records the next time you visit a site.

How do I check my DNS cache?

On Windows, open Command Prompt and run ipconfig /displaydns to list every entry currently held. macOS and Linux don’t show the cache as plainly, but you can confirm which server is answering with an online DNS check tool.

Should I enable DNS cache?

For most people, yes — it’s on by default and speeds up web browsing by cutting repeat lookups. Leaving caching enabled means faster load times and less network traffic. You only need to clear it when records go stale or you’re troubleshooting.

Does clearing DNS cache delete history?

No. Clearing the cache does not delete your browser history, bookmarks, or saved logins. It only clears the list of domain-to-address lookups. Your browsing history lives separately and stays intact.

Is changing DNS to 8.8.8.8 safe?

Yes. 8.8.8.8 is Google’s public DNS resolver, a widely used and reliable service. Switching to it is safe and can improve reliability. For stronger privacy, pair a trusted DNS service with an encrypted connection so your queries aren’t visible to your provider.

How do I tell if my DNS is hijacked?

Warning signs include sites redirecting to unexpected pages, frequent certificate errors, or search results that look tampered with. Run a DNS check to see which server is answering — if it’s one you never set, your settings may have been changed. Clearing the cache and resetting your DNS settings is the first fix.