The DNS cache refers to the domain name resolution records temporarily stored in the operating system or browser, used to speed up subsequent visits. If the cache contains outdated or incorrect records, a website may fail to load properly. Clearing the DNS cache forces the system to fetch the latest resolution information from the DNS server again. Detailed steps are provided below by platform. Please note that it is recommended to run the commands with administrator privileges before proceeding, and to restart the browser or device after clearing to verify the effect.

Windows

  1. Press Win + R to open the “Run” dialog, type cmd, then press Ctrl + Shift + Enter to run Command Prompt as administrator.
  2. In Command Prompt, type the following command and press Enter to execute it: ipconfig /flushdns The system will display the message “Successfully flushed the DNS Resolver Cache”.
  3. Optional: type ipconfig /renew to obtain a new IP address.

macOS

  1. Open the “Terminal” application (find it via Spotlight search or under “Applications > Utilities”).
  2. Type the following command and press Enter to execute it (you will need to enter the administrator password): sudo killall -HUP mDNSResponder or for older versions: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. The Terminal will show no noticeable output, but the cache has been cleared.

Linux

Linux distributions vary, and the commands differ from system to system. Please adjust according to your distribution.

  1. Open a terminal.
  2. For systems using systemd-resolved (such as Ubuntu 18.04+): sudo systemd-resolve --flush-caches
  3. For systems using nscd: sudo /etc/init.d/nscd restart or sudo systemctl restart nscd
  4. For systems using dnsmasq: sudo systemctl restart dnsmasq
  5. Restart the network service: sudo systemctl restart NetworkManager (applicable to most desktop distributions).

Browser Cache (Chrome, Firefox, etc.)

Browsers maintain their own DNS cache independently and need to be cleared separately.

  • Chrome:
    1. Type chrome://net-internals/#dns in the address bar and press Enter.
    2. Click the “Clear host cache” button.
  • Firefox:
    1. Type about:networking#dns in the address bar and press Enter.
    2. Click the “Clear DNS Cache” button.
  • Safari:
    1. Enable the “Develop” menu (Safari > Preferences > Advanced > Show Develop menu).
    2. Select “Empty Caches” from the “Develop” menu.

 

If the problem persists, it is recommended to check your network settings or contact your system administrator. After clearing the cache, the first visit to a website may be slightly slower, since the domain name needs to be resolved again.