{"id":4877,"date":"2020-06-18T11:38:01","date_gmt":"2020-06-18T11:38:01","guid":{"rendered":"https:\/\/blog.ssdnodes.com\/blog\/?p=4877"},"modified":"2025-05-18T18:46:45","modified_gmt":"2025-05-18T18:46:45","slug":"flush-dns-cache","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/flush-dns-cache\/","title":{"rendered":"How to Flush DNS Cache on Windows, Linux, and macOS"},"content":{"rendered":"\n<p>If you're having issues connecting to certain websites, it's probably time to clear your DNS cache. In this post, we'll cover exactly how to flush your DNS cache and why it actually matters...<\/p>\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1592477027158\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is the Domain Name System (DNS)? <\/h3>\n<div class=\"rank-math-answer \">\n\n<p>The Domain Name System (DNS) is a naming system for devices or services connected to the internet which converts domain names into IP addresses. <\/p>\n<p>The DNS cache present in your device contains all the domain names converted into IP addresses, which makes accessing them faster because it is no longer necessary to process the conversion every single time a request to websites you've already visited is made. However, sometimes it can be useful to flush this cache \u2013 keep reading to find out how... <\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<h2 class=\"wp-block-heading\"><b>The Benefits of Periodically Flushing Your DNS Cache<\/b><\/h2>\n\n\n<p>The answer to some common problems you might face when building and setting up new sites and changing domain names can be flushing the DNS cache on your device locally. <\/p>\n\n\n<p>Here's why <strong>regularly clearing your DNS cache<\/strong> is important: <\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong>For Security<\/strong><\/li><\/ul>\n\n\n<p>Your DNS cache files are the main target of <strong><a href=\"https:\/\/www.cloudflare.com\/learning\/dns\/dns-cache-poisoning\/\" target=\"_blank\" rel=\"noopener\">DNS Spoofing<\/a><\/strong>, which is a type of attack that alters DNS records in order to redirect online traffic to a fraudulent website that resembles its intended destination. This is dangerous because you may unknowingly be passing on your personal information (such as login credentials or even payment information) to this fake website.  <\/p>\n\n\n<p>Flushing your DNS cache empties it of most files (except those related to automatic updates), which significantly reduces the chances of this happening...<\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong>To Resolve Bad Connections<\/strong><\/li><\/ul>\n\n\n<p>If your website doesn\u2019t load on a particular device but loads on other devices, it\u2019s most likely due to DNS caching issue. <\/p>\n\n\n<p>By flushing your DNS cache, the wrong IP address entry will be removed and the right\/up-to-date IP address will be used when the next request is made.<\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong>Remove Old DNS Data<\/strong><\/li><\/ul>\n\n\n<p>Since there are a number of popular DNS providers, such as DNS Made Easy or Cloudflare \u2013 you might run into problems if you\u2019ve recently changed your DNS provider but your cache still contains the data with the data from your old DNS provider \u2013 like the websites that you\u2019ve been accessing regularly. <\/p>\n\n\n<p>When this is the case, your devices will still be using the old records instead of the new records which can be resolved by flushing your DNS cache. <\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong>Maintenance<\/strong><\/li><\/ul>\n\n\n<p>Another benefit of flushing the DNS cache is that it is good practice for maintenance. Although DNS cache files don\u2019t take up a lot of space, the list obviously does grow quickly over time if you don\u2019t flush the cache regularly. <\/p>\n\n\n<p>By flushing the cache, records can be properly expunged so resolvers will no longer use now out-of-date information and you can resolve 404 errors you encounter when trying to access certain sites. <\/p>\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1592470247056\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">When Do I Need To Flush My DNS Cache?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>We recommend clearing your DNS cache fairly <strong>frequently<\/strong>, especially when performing site migrations (changing DNS servers) or when you're specifically experiencing issues such as not seeing changes propagate when a site migration is supposedly complete. <\/p>\n<p>Even if this is not the case, any outdated DNS cache files might expose you to security vulnerabilities, so our recommendation is to flush the DNS cache occasionally...<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<h2 class=\"wp-block-heading\"><b>How Do I Flush My DNS Cache on macOS?<\/b><\/h2>\n\n\n<p>Here is how to flush your DNS cache on the different version of macOS: <\/p>\n\n\n<ol class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Press the F4 key, enter <\/span><b>Terminal <\/b><span style=\"font-weight: 400;\">in the <\/span><b>Launchpad\u2019s <\/b><span style=\"font-weight: 400;\">search field to open the terminal window, or go to <\/span><b>Applications<\/b><span style=\"font-weight: 400;\">, click <\/span><b>Utilities<\/b><span style=\"font-weight: 400;\">, and then <\/span><b>Terminal<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><li><span style=\"font-weight: 400;\">Type one of the following commands depending on the macOS version that you are using and press Enter to flush the DNS cache<\/span>...<\/li><\/ol>\n\n\n<ul class=\"wp-block-list\"><li><b>Mac OS X Yosemite -<\/b> <span style=\"font-weight: 400;\">sudo discoveryutil udnsflushcaches<\/span><\/li><li><b>Mac OS X Snow Leopard<\/b><span style=\"font-weight: 400;\"> - sudo dscacheutil -flushcache<\/span><\/li><\/ul>\n\n\n<ul class=\"wp-block-list\"><li><b>Mac OS X Leopard - <span style=\"font-weight: 400;\">sudo lookupd -flushcache<\/span><\/b><\/li><\/ul>\n\n\n<ul class=\"wp-block-list\"><li><b>Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion - <\/b><span style=\"font-weight: 400;\">sudo killall -HUP mDNSResponder<\/span><\/li><\/ul>\n\n\n<h2 class=\"wp-block-heading\"><strong>How Do I Flush My DNS Cache on Windows?<\/strong><\/h2>\n\n\n<p><span style=\"font-weight: 400;\">Here is how you can flush DNS cache on Windows XP, Vista, 7, 8, 8.1 and 10.<\/span><\/p>\n\n\n<ol class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Open the <\/span><b>Command Prompt<\/b><\/li><\/ol>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><b>Windows XP<\/b><span style=\"font-weight: 400;\">: Open the Start Menu and click Run. Then, type in cmd and press <\/span><b>Enter<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><li style=\"font-weight: 400;\"><b>Windows Vista\/7<\/b><span style=\"font-weight: 400;\">: Type cmd in the search bar and press <\/span><b>Enter<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><li style=\"font-weight: 400;\"><b>Windows 8, 8.1, and 10<\/b><span style=\"font-weight: 400;\">: Press the <\/span><b>Windows logo key <\/b><span style=\"font-weight: 400;\">and <\/span><b>X <\/b><span style=\"font-weight: 400;\">on your keyboard. Then, click on the Command Prompt.<\/span><\/li><\/ul>\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li><span style=\"font-weight: 400;\">Flush DNS<\/span><\/li><\/ol>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Type ipconfig \/flushdns and press <\/span><b>Enter<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><\/ul>\n\n\n<h2 class=\"wp-block-heading\"><b>How Do I Flush My DNS Cache on Linux?<\/b><\/h2>\n\n\n<p><span style=\"font-weight: 400;\">By default, Ubuntu does not cache DNS entries. However, if you have manually installed a DNS service, such as <\/span><b>name service caching daemon<\/b><span style=\"font-weight: 400;\"> (nscd), then you can periodically flush the DNS cache. The method provided below will show you how you can flush your DNS cache.<\/span><\/p>\n\n\n<ol class=\"wp-block-list\"><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Press <\/span><b>Ctrl+Alt+T<\/b><span style=\"font-weight: 400;\"> together to open the terminal window.<\/span><\/li><li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The next step is to enter the following command <\/span><span style=\"font-weight: 400;\">to clear DNS cache files on init.d subdirectory: <\/span><span style=\"font-weight: 400;\">sudo \/etc\/init.d\/nscd restart.<\/span><\/li><\/ol>\n\n\n<h2 class=\"wp-block-heading\"><b>Conclusion<\/b><\/h2>\n\n\n<p><span style=\"font-weight: 400;\">The purpose of the DNS cache is to accelerate the browsing process by assigning a domain name to an IP address. However, if it\u2019s not properly maintained, your DNS cache can prevent you from accessing web pages or temporarily prevent you from accessing your own site after changing DNS records or provider entirely. <\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">For this reason, <\/span><b>it\u2019s important that you flush the DNS cache periodically<\/b><span style=\"font-weight: 400;\">. <\/span><\/p>\n\n\n<p><span style=\"font-weight: 400;\">Thankfully, the steps for flushing the DNS cache for macOS, Windows, and Linux are easy to follow.<\/span> If this doesn't resolve your issue \u2013 you might also need to <a href=\"https:\/\/support.google.com\/accounts\/answer\/32050\" class=\"rank-math-link\" target=\"_blank\" rel=\"noopener\">clear your browser cache<\/a>...<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re having issues connecting to certain websites, it&#8217;s probably time to clear your DNS cache. In this post, we&#8217;ll cover exactly how to flush your DNS cache and why it actually matters&#8230; What is the Domain Name System (DNS)? The Domain Name System (DNS) is a naming system for devices or services connected to  &#8230;<\/p>\n","protected":false},"author":20,"featured_media":4890,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[235,234,237,238,236],"class_list":["post-4877","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-cache","tag-dns","tag-linux","tag-macos","tag-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=4877"}],"version-history":[{"count":2,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4877\/revisions"}],"predecessor-version":[{"id":13031,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4877\/revisions\/13031"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/4890"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=4877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=4877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=4877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}