What is DNS Cache and how can I clear it?

What is DNS cache?

Every time you visit a website in your browser, your computer asks other computers connected to the Internet (DNS servers) where this website is located.

Instead of asking every time you visit the same website, your browser remembers the answers it receives. It stores these answers in a list for a while.

This list is what we call the DNS Cache. It helps your computer to work faster because it does not have to ask the same questions again and again. It has already saved the answers so that you can use the Internet faster and more efficiently.

So the DNS cache is like a cheat sheet that helps your computer find websites faster because it remembers where they are. DNS caching therefore helps to reduce the load on DNS servers.

However, DNS cache can sometimes lead to a situation where you don't see the actual state of a website immediately after changes to the DNS records have been made.

Reasons for this can be:

Caching periods: DNS records are given a time-to-live (TTL) value. This TTL value indicates how long the information (such as the IP address of a website) can be cached by DNS resolvers or your local device. During this TTL period, even if the actual state of the website changes, your device can use the old information from the cache.

DNS propagation time: When changes are made to DNS records (e.g. updating the IP address of a website), it takes some time for these changes to propagate to all DNS servers on the Internet. Until the new information is fully propagated, some DNS servers may still provide the old information.

How can I clear the DNS cache?

To clear the DNS cache and see the current state of a website after changes to the DNS records, you can try the following:

Delete DNS cache: On your local device, you can clear the DNS cache. This depends on your operating system. On Windows, for example, you can open the command prompt and enter ipconfig /flushdns. On macOS, you can use sudo killall -HUP mDNSResponder.

Wait until the TTL expires: The TTL (time-to-live) value in the DNS records determines how long the information is cached. If you do not want to delete the cache manually, you can wait until the TTL of the DNS entries expires. After this period, your system will request new DNS information. The TTL value is specified in seconds. If, for example, a TTL value of 3600 is stored, this means that you have to wait 1 hour.

Use a different browser or device: If clearing the DNS cache does not work on your current device, you can try to access the website using a different browser or device. Each device manages its own DNS cache.

Tip: One simple option is to deactivate the Wi-Fi on your smartphone so that only the LTE connection is available. If you then open the website in your smartphone's mobile browser, you should see the current status of the website. This usually works reliably as you bypass the DNS cache of your home network by switching to the LTE connection.

Use private browsing/incognito mode: When browsing in private or incognito mode, the DNS information from the cache is usually not used. Open the private browsing mode of your browser and try to access the website.

Check the DNS propagation: Use online tools such as https://www.whatsmydns.net/ to check the DNS propagation status. These tools can show you if the updated DNS information has propagated worldwide. Keep in mind that DNS propagation can take some time.