
What Is DNS Cache? How It Works, Flush & Troubleshooting
You’ve probably been there: a website won’t load, but you can ping the server by IP address. Or a site moved to a new host, but your browser keeps showing the old version. The culprit is often sitting in a hidden cache on your device, and clearing it takes less than a minute once you know how. This guide covers what DNS cache actually is, why it matters for both speed and security, and how to flush it on every platform you own.
Storage Location: OS, browser, or resolver · Primary Purpose: Speed up repeat DNS lookups · Common Issue Trigger: Outdated records causing errors · Flush Command Example: ipconfig /flushdns (Windows)
Quick snapshot
- DNS cache stores records of recent domain lookups to enable faster resolution on subsequent visits (Unstoppable Domains)
- Cached DNS records can become outdated or corrupted, causing errors such as pages not loading, DNS server not responding, or trouble connecting to certain sites (Bitdefender)
- When troubleshooting network connectivity issues or DNS-related errors, flushing the DNS cache is one of the most common and effective first steps (UCSF IT)
- Exact TTL values vary by resolver and are not standardized across all DNS configurations
- Mobile carrier DNS resolvers may apply different caching policies than public DNS services
- Recent domain migrations typically trigger DNS cache refresh cycles within hours
- Security advisories on DNS cache poisoning have increased over the past two years, raising awareness of cache management
- DNS over HTTPS (DoH) adoption is reducing reliance on traditional OS-level DNS caching
- Browser-level DNS management features are expanding, giving users more granular control
The table below consolidates flush commands and key parameters across platforms for quick reference.
| Field | Value |
|---|---|
| Definition | Temporary DNS lookup storage |
| Levels | Browser, OS, Resolver |
| Flush Impact | Clears outdated records instantly |
| Storage Type | Volatile memory |
| Command (Windows) | ipconfig /flushdns |
| Command (macOS 10.10.4+) | sudo killall -HUP mDNSResponder |
| Command (Linux systemd) | sudo systemd-resolve –flush-caches |
| Browser Clear (Chrome) | chrome://net-internals/#dns |
What Is DNS Caching?
DNS cache is temporary storage on your device that holds recent domain name lookups. When you visit a website, your computer needs to find the IP address that corresponds to the domain name you typed. The DNS cache stores these mappings so that repeat visits resolve faster, without querying external servers again.
This cache operates at multiple levels. The operating system’s stub resolver intercepts every DNS query before it leaves the machine and checks its own cache first (Unstoppable Domains). Unlike browser caches that serve only web traffic, the OS stub resolver handles DNS requests from all applications running on a device. Browsers like Chrome and Firefox maintain their own separate DNS caches as well, layering additional resolution speedups on top of the OS cache.
How DNS cache works
When you enter a domain name like example.com, the DNS resolver checks the local cache. If the record exists and has not expired, the lookup completes instantly. If the record is missing or expired, the resolver queries upstream DNS servers, receives the response, and stores it locally with a Time-To-Live (TTL) value that determines how long it stays cached.
The cached information includes the domain name, resolved IP address, record type, TTL value, and server names associated with the domain. This means that after the first visit, subsequent visits to the same site load noticeably faster because your device skips the external lookup step entirely.
DNS caching provides critical advantages that enhance the performance, reliability, and cost-efficiency of internet services. Each cached lookup saves latency and reduces DNS query load on upstream servers.
DNS cache example
Consider a scenario where a website recently migrated to new hosting. Users who visited the site before the migration may see the old content or a broken page because their local DNS cache still holds the old server’s IP address. Flushing the DNS cache forces the device to perform a fresh lookup, retrieving the updated IP address from the DNS server.
The DNS cache is a temporary storage system that keeps records of recent domain lookups so devices can resolve domains faster.
DNS caching provides critical advantages that enhance the performance, reliability, and cost-efficiency of internet services.
Is it safe to clear DNS cache?
Yes, clearing your DNS cache is safe for most users. It resolves stale data issues without causing any permanent data loss. Flushing the DNS cache clears out stored records and forces a device to request fresh information from the DNS server (Bitdefender Support).
The only trade-off is a temporary slowdown on first visits after flushing, because the device must perform fresh DNS lookups for every domain. However, modern network speeds make this delay negligible in most cases.
Keeping DNS caching on improves performance; turning it off or flushing too frequently may increase latency for first visits. Leave caching enabled for everyday use and flush only when troubleshooting.
Pros and cons of clearing
- Pros: Fixes stale records from domain migrations, resolves DNS errors, can purge search history that hackers could exploit, improves security after suspected poisoning attempts
- Cons: Temporary slowdown on first visits post-flush, requires user action to perform
When to clear DNS cache
Clear your DNS cache after a website migrates to new hosting, when you cannot access a site that works for others, after a suspected security incident, or when instructed by IT support as part of troubleshooting. According to UCSF IT, flushing the DNS cache is one of the most common and effective first steps when troubleshooting network connectivity issues or DNS-related errors (UCSF IT Department).
How do you flush a DNS cache?
Flushing the DNS cache clears out stored records and forces your device to request fresh information from DNS servers. The process differs by operating system and browser, but each method takes under a minute once you know the steps.
Flush on Windows
To flush DNS cache on Windows 10 and 11, press Windows key + R, type cmd, and press Ctrl + Shift + Enter to open Command Prompt with administrator privileges. Run the command ipconfig /flushdns. Windows displays the confirmation message “Successfully flushed the DNS Resolver Cache” after executing the command (Control D Blog).
Flush on macOS
For macOS 10.10.4 and later versions, open Terminal and run sudo killall -HUP mDNSResponder. For macOS 10.11 (El Capitan) and later, the recommended command is sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder (N-able Blog). Note that macOS does not generate a success message after flushing DNS cache, so verify by attempting to access a domain.
Flush on Linux
Linux DNS cache handling depends on which service your distribution uses. On systems using systemd-resolved, run sudo systemd-resolve --flush-caches. On systems using nscd, restart the service with sudo systemctl restart nscd (Remote Utilities Support Knowledge Base).
Flush in browsers
- Google Chrome: Enter
chrome://net-internals/#dnsin the address bar and click “Clear host cache” (Tribulant Blog) - Microsoft Edge: Enter
edge://net-internals/#dnsin the address bar and click “Clear host cache” - Firefox: Enter
about:networkingin the address bar and click the “Clear DNS Cache” button - Vivaldi: Enter
vivaldi://net-internals/#dnsin the address bar and click “Clear host cache” - Safari: Relies on the system’s local DNS cache rather than maintaining its own separate browser cache (Tribulant Blog)
On Android and iOS, the simplest way to clear DNS cache is to restart Wi-Fi—turn it off and on again, then reopen your applications. Streaming devices that lack command-line access follow the same approach.
Should DNS caching be on or off?
For most users, DNS caching should stay on. The performance benefit of faster repeat lookups outweighs the rare risk of stale records. DNS caching provides critical advantages that enhance the performance, reliability, and cost-efficiency of internet services (Verge Cloud).
Turning off DNS caching entirely is rarely necessary outside of specific development or troubleshooting scenarios. The trade-off is increased latency on every DNS lookup, because your device must query external DNS servers for every domain visit.
Benefits of DNS caching
- Faster page loads for repeat visits to the same domains
- Reduced load on upstream DNS servers
- Lower latency for frequently visited websites
- Improved overall browsing performance
When to disable
Consider temporarily disabling DNS caching only when troubleshooting specific DNS resolution problems, testing DNS configuration changes, or when security concerns outweigh performance benefits. For most users, the default caching behavior strikes the right balance.
What does it mean to have a problem with the DNS cache?
A DNS cache problem means your device is holding onto outdated or corrupted domain records. When cached DNS records become stale after a domain migration or server IP change, you may see pages not loading, DNS server errors, or trouble connecting to specific sites while other sites work fine.
Common symptoms
- Website fails to load but works on mobile data or another network
- DNS server not responding error messages
- Site redirects to the wrong server or shows old content
- Inability to connect to specific domains while others load normally
How to fix DNS cache problems
Start by viewing your DNS cache to confirm the problematic entries are present. On Windows, use the command ipconfig /displaydns to see all cached entries (Verge Cloud Blog). On macOS, inspect cached DNS entries using sudo dscacheutil -cachedump -entries Host. On Linux, use systemd-resolve --statistics or sudo nscd -g to check DNS cache status.
If the entries look outdated or suspicious, flush the DNS cache using the appropriate command for your operating system. If problems persist after flushing, consider switching to alternative public DNS servers like Cloudflare (1.1.1.1) or Google (8.8.8.8) to bypass your ISP’s resolver.
DNS cache poisoning—where hackers inject false records into your resolver’s cache—poses a security risk. Hackers use DNS spoofing techniques to compromise operating systems, making regular DNS cache flushing important from a security perspective (HostStud Security Guide).
Upsides
- Faster repeat visits to cached domains
- Reduced DNS query load on upstream servers
- Lower browsing latency for frequently accessed sites
- Flush clears stale records from domain migrations
- Security benefit: purges records that hackers could exploit
Downsides
- Temporary slowdown on first visits post-flush
- Stale records can block access to migrated websites
- Cache poisoning risk if security is compromised
- Requires user action to flush when needed
Our troubleshooting steps align closely with practices in Windows 11 DNS cache guide, which details safe clearing on Windows 11 and mobile for faster resolutions.
Frequently asked questions
What is DNS cache on Android?
Android devices do not maintain a separate DNS cache at the OS level. The simplest way to clear DNS cache on Android is to restart Wi-Fi—turn it off and on again, then reopen your applications. This forces the device to establish a fresh connection and resolve domains anew.
How to view DNS cache on Android?
Android does not provide a built-in command to view DNS cache contents like Windows or macOS do. Your best option is to use a network diagnostic app or check your router’s DNS cache if it maintains one. Restarting Wi-Fi clears the active DNS resolution state.
How to fix a problem with DNS cache?
First, verify your physical network connection is working. Then clear your local DNS cache using the appropriate command for your operating system. If the problem persists, switch to a public DNS server like Cloudflare (1.1.1.1) or Google (8.8.8.8). Verify that the domain resolves correctly using an online DNS lookup tool.
Where is DNS cache stored?
DNS cache is stored in volatile memory on your device at multiple levels: the operating system’s stub resolver (Windows, macOS, Linux), individual web browsers (Chrome, Firefox, Edge), and network resolvers managed by your ISP or public DNS service.
What DNS does Ubiquiti use?
Ubiquiti devices typically use the DNS servers configured in your DHCP settings or manually specified DNS servers. Many Ubiquiti users configure Cloudflare (1.1.1.1) or Google Public DNS (8.8.8.8) for privacy and performance. Check your UniFi controller’s network settings for the current DNS configuration.
Is 8.8.8.8 and 8.8.4.4 DNS safe?
Yes, Google Public DNS (8.8.8.8 and 8.8.4.4) is a legitimate and widely-used public DNS service. It offers privacy, performance benefits, and security features. Many users and organizations trust it as an alternative to ISP-provided DNS resolvers.
Does 8.8.8.8 make your internet faster?
Google Public DNS can improve browsing speed if your ISP’s DNS resolver is slow or overloaded, but it does not increase your raw internet connection speed. The benefit comes from faster DNS resolution, which reduces the time before a website starts loading.
Related reading
- What Is a Personal Hotspot? iPhone Setup, Costs & Risks
- What Is a MIDI File? Definition, Playback & Conversion Guide
For anyone who manages multiple devices or networks, understanding DNS cache is essential. The mechanism underpins every fast website load you experience, and knowing how to flush it solves one of the most common categories of connectivity problems. Flushing DNS cache costs nothing, takes under a minute, and should be in every power user’s troubleshooting toolkit.