How to Flush Your Local DNS Cache on Windows, macOS, Linux & Mobile
When you type a domain name like perplexity.ai or github.com into your browser, your operating system does not query global DNS servers every single time. Instead, it saves recently resolved IP addresses in a temporary local database known as the DNS Resolver Cache.
While caching makes everyday web browsing significantly faster, it creates a common problem: if a website migrates to a new server IP, switches CDN providers, or recovers from a temporary DNS misconfiguration, your computer may continue trying to connect to the old, dead IP address until the cached record's Time-To-Live (TTL) expires.
1. Flush DNS Cache on Windows 10 & Windows 11
On Windows, the DNS Client service manages cached domain records. You can clear it in seconds using Command Prompt, PowerShell, or Windows Terminal:
- Press
Win + R, typecmd, and press Enter. - Type the following command and press Enter:
ipconfig /flushdns
You will immediately see the confirmation message: "Successfully flushed the DNS Resolver Cache."
2. Flush DNS Cache on macOS (Sonoma, Sequoia, Ventura & Monterey)
On modern macOS releases, DNS caching is handled by both a directory service cache and the mDNSResponder daemon. Open the Terminal app (via Spotlight Cmd + Space) and run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Enter your Mac login password when prompted (characters will not appear as you type) and press Return.
3. Flush DNS Cache on Linux (Ubuntu, Debian, Fedora)
Most modern Linux distributions use systemd-resolved to manage local DNS caching. Open your terminal and run:
sudo resolvectl flush-caches
If your distribution uses dnsmasq or nscd instead, restart the respective daemon using sudo systemctl restart dnsmasq or sudo systemctl restart nscd.
4. Clear Internal Browser DNS & Socket Cache (Chrome, Edge, Brave)
Chromium-based browsers maintain their own internal DNS cache separate from your operating system. Even after running ipconfig /flushdns, your browser may hold onto stale active sockets:
- Open a new tab and paste the following internal address into the URL bar:
chrome://net-internals/#dns
- Click the "Clear host cache" button.
- Next, navigate to
chrome://net-internals/#socketsin the left menu and click "Flush socket pools".
5. Clear DNS Cache on iOS (iPhone / iPad) and Android
Mobile operating systems do not provide a terminal command for unrooted devices, but you can force an immediate network stack and DNS flush using either of these methods:
- Toggle Airplane Mode: This may refresh the device's network connection, though behavior varies by device and it is not guaranteed to clear every DNS cache.
- Choose Encrypted DNS: On supported Android devices, a Private DNS provider hostname such as
one.one.one.oneordns.googlecan route DNS queries through that provider. Availability and effects depend on device and network configuration.