How to Clear the DNS Cache on Your Computer

Edited

Overview

Clearing your computer's DNS (Domain Name System) cache can resolve connectivity issues, ensure access to updated website content, and help ensure accurate name resolution and avoid unnecessary DNS lookup delays. This process forces your system to fetch the latest DNS information, which is particularly useful after domain changes or when experiencing DNS-related errors.​


How It Works

Your computer stores DNS records to expedite the process of translating domain names into IP addresses. Over time, these cached records can become outdated or corrupted, leading to issues like website loading errors or security vulnerabilities. Flushing the DNS cache removes these stored entries, prompting your system to retrieve fresh DNS data from authoritative servers.​


Step-by-Step Instructions

For Windows 10 and 11

  1. Open Command Prompt as Administrator

    • Click on the Start menu, type cmd, then right-click on Command Prompt and select Run as administrator.​

  2. Flush the DNS Cache

    • In the Command Prompt window, type the following command and press Enter:​

      ipconfig /flushdns 
  3. Confirmation Message

    • You should see a message stating:

      Successfully flushed the DNS Resolver Cache.

For macOS (Monterey, Ventura, and newer)

  1. Open Terminal

    • Press Command + Spacebar to open Spotlight Search, type Terminal, and press Enter.​

  2. Flush the DNS Cache

    • In the Terminal window, enter the following command and press Enter:​

      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder 
  3. Enter Administrator Password

    • When prompted, enter your administrator password. Note that the cursor will not move as you type.

  4. No Confirmation Message

    • The command executes silently. Once the prompt returns, the DNS cache has been cleared.​

For Linux (Ubuntu 17.04 and newer)

  1. Open Terminal

    • Press Ctrl + Alt + T or search for Terminal in your applications menu.​

  2. Flush the DNS Cache

    • Depending on your system, enter one of the following commands and press Enter:​

      • For systems using resolvectl (Preferred for newer systems ):

        sudo resolvectl flush-caches 
      • For systems using systemd-resolved (For older systems with systemd-resolve):

        sudo systemd-resolve --flush-caches  
  3. Enter Administrator Password

    • When prompted, enter your administrator password.​

  4. No Confirmation Message

    • The command executes silently. Once the prompt returns, the DNS cache has been cleared.​

Note: Some Linux distributions may not cache DNS by default. If you receive an error indicating that the service is not found, your system may not be using a DNS caching service.​


Pro Tip: After flushing your DNS cache, it's a good practice to restart your web browser and clear its cache to ensure all outdated DNS records are removed.