How to block ads in Microsoft Edge browser (Project Spartan)

During Build 2015, Microsoft made an announcement that Project Spartan which replaced Internet Explorer in Windows 10 is officially named Microsoft Edge. It is a WinRT-based browser. In the initial release, it won't support extensions or add-ons. So there can be no adblock extension or other tool to block ads in Edge for a while. Here is a trick which will allow you to block ads in the Microsoft Edge browser.
microsoft edge logo bannerTo block ads in the Microsoft Edge browser, we can use the good old HOSTS file trick. By inserting the appropriate lines in the hosts file, it is possible to get rid of most ad networks and malicious sites. Here's how it's done:

  1. Download the HOSTS.ZIP file from the site.
  2. Extract all files from the provided ZIP archive into any folder. Even the Desktop folder is suitable.
  3. Run the extracted mvps.bat file as administrator. It will modify your hosts file automatically; no manual editing is required. If you run this file once again as administrator, it will revert all the changes it made.

Restart the Edge browser. The changes will take effect immediately. Almost all ads will be gone from web pages that you open.

However, you might face another issue - the modified HOSTS file causes delays in the loading of websites. Web pages can open slower than usual. This happens because with a large hosts file, the client-side Windows DNS cache becomes less responsive. Here is another fix to avoid this issue:

  1. Open Registry Editor.
  2. Navigate to the following Registry key:

    Tip: How to jump to the desired Registry key with one click.

  3. Create a new DWORD value "MaxCacheTtl" and set the value to 1. This value indicates the TTL for positive DNS query responses. By lowering it to 1, it effectively disables the client-side DNS cache.
  4. Create a new DWORD "MaxNegativeCacheTtl" and set the value to 0. This is the TTL value for negative responses. By setting it to 0, negative responses won't be cached either.
  5. Restart your PC.

Note that the tweak above will increase network traffic for DNS queries to the server as the DNS client-side cache is disabled. However, it is not a big issue and you should not notice any network performance degradation from it.

You are done. Now you got rid of ads in Microsoft Edge (Spartan) browser. It will affect other apps as well, e.g. other web browsers you have installed. If you are not happy with this trick, you can restore the original HOSTS file by running the mvps.bat file once again as administrator and deleting the mentioned MaxCacheTtl and MaxNegativeCacheTtl Registry values.

Tell us your experience after doing this tweak. Do you experience any slowdown in browsing with Microsoft Edge?

All credits for this trick go to our friend, Christ123NT. Chris also wrote about a very useful way to disable ads in Skype without using third party tools.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

32 thoughts on “How to block ads in Microsoft Edge browser (Project Spartan)”

  1. is the DWORD 32 or 64 bit? it seems fine butt maybe a little slower and I havent seen any add yet thank u guys!!

  2. What did i wrong? Is that normal? [NOTE:I am Brazilian, so the language is Portuguese.]

  3. Hey there are some bugs with this “adblock”. I’m using it, but it limits functionality honestly. When you go into google, it doesn’t block the ads. But if you click them, the links don’t work! Also, sometimes the “this Page cannot be displayed!” is more annoying than the ad itself. But yeah, that’s the problem with this fix.

    Thanks for trying to help though, I think I will allow ads and maybe use Chrome.

  4. I installed it, but decided later that I don’t want it anymore. I believe I uninstalled it and deleted the files already, but when I go on youtube it doesn’t show ads but it still has the annoying error pictures as the ads.

  5. Having regular folks modify the HOSTS file is a recipe for disaster. I upgraded to 10, and I used Edge. I like it, but w/o ad blocking it’s horrendous. I’m amazed at how many ads sites I go to cram down my throat (that normally are blocked in Firefox). Edge is basically part of Win 10’s scheme … you are NOT the customer anymore. You are a consumer. Every other company out there is now MS’ customer … companies that give you web-pages with ads on them get preferential treatment then you wanting to block those ads (and save your bandwidth). Everything about Win 10 is designed to monetize you with stores and app purchases or collect info off you to monetize by targeting ads and market research analysis.

    Look at it this way … you have to use POWERSHELL script hacks to remove things like Cortana, Xbox store, App Store, etc from Win 10. Why? Because MS doesn’t want you to control the gateways they built in to monetize you. You have to use HOSTS file hacks to half-assed adblock in Edge. Why? Because MS wants to cater to web sites that want to ad-spam you, not cater to you and your individual browser desires.

    Win 10 is not about you. You are not a customer. You are a consumer. And having to bend over backwards to get what you want in the OS is just a slap in the face to make you realize that.

    1. Hi, A customer is a kind of consumer; not all consumers are customers, but every customer is by definition a consumer. You have been a customer/consumer of Microsoft since back in the day when you had to fork over $200,- to buy their OS; there’s nothing new there. You seem to suggest that Microsoft shouldn’t try and make money; well how are they going to make software and services if nobody gives them money for it? There’s plenty of other options for you if you want a free OS; there’s great Linux distributions that support basically all features you’ll ever need for everyday use.

    2. blah blah, yes we are consumers, this is how the modern economies are working anywhere in developed countries. There are a lot of people struggling to survive while working at the companies where the ads point at. Even android in mobile devices has its own native browser which cannot be easily uninstalled. I do not care about their “war” competition, this one among software and hardware companies. We are able to use whichever browser we mostly like. Yes, i agree that microsoft could have everything easily be uninstalled by the user but given the huge illegal use of windows worldwide, at least they try to promote their services. This also happens by apple or sony who are not so open to software and hardware vendors. You can try a linux distribution for your activities online, it s free, flexible and really nice. At least many people tinker with windows os and provide easy solutions for those interested in modifying the operating system. Bye.

  6. Tried this, didn’t work out so well for me (not blaming the web site). I just wanna know how to undo and uninstall all of this stuff? Can any body help?

    1. Just reverse the process starting from bottom up… Instead of create, delete, install, remove, etc… As for the host file, delete it. Windows will create another based off the default.

      1. For those wanting to check where the host files are located, open file explorer and look in C:\Windows\system32\drivers\etc\hosts. If you do not see the file, you will need to make sure to have file explorer set to read hidden files. Go to “Folder Options”, then “View”. Under the “Advanced Settings”, look for “Hidden Files and Folders”. Then select “Show Hidden Files, Folders, Drives”. You should be able to now see the hidden hosts file. This file is only about 400kb in size if you changed it by going to as recommended in this article. It can now be deleted. As mentioned, after you delete the file, Windows will create a new one. It will only be a few kb’s in size from what was just deleted.
        The host files can be viewed and edited just by using Note Pad.

  7. simple solution – if you don’t like it don’t use it chrome still works with ad blockers others also.

    1. No it is not automatically updated. I usually go to the about once a month an download the latest host file and install it again.

  8. HI, I used your method to remove the ads which worked fine but it also blocked other content that I needed. I tried to reverse the process as per your instructions but it has not worked. Please can you advise me how to get my system back to how it was? I cannot do system restore as there is no restore point.

    Thank you for your help.


    1. Mark. You can edit a blocked website. Open the Hosts File using Note Pad.
      Example. Lets say you want to click a link,, but it is blocked.
      Do a Ctrl F. The Find Box will appear. Type in the Website you want to unblock.
      It should find All you need to do to unblock the site is to add # at the beginning.
      It will like this: # Save the text file. Now should be unblocked.
      Or as mentioned you can just delete the whole Hosts File and the a neww one will be created.

  9. Ads are certainly an important issue, but there are others, for instance (I’m cribbing this stuff from other sites):

    An excerpt from the MS Windows 10 EULA (End User License Agreement):
    “Finally, we will access, disclose and preserve personal data, including your content (such as the content of your emails, other private communications or files in private folders), when we have a good faith belief that doing so is necessary.”

    Necessary for what and whom?

    So, Microsoft can take anything that exists on your system and do anything it wants with it, “…such as the content of your emails, other private communications or files in private folders…”. Everything.

    If you’ve only been worried about ads, you maybe should figure this out too. Links to get started with:

    You might also read the linked page’s comments and follow the embedded links.

    Yeh, this sort of thing has been going on a long time, in a bit more limited way, but Microsoft wants to be able to suck your computer dry, by having you use Windows 10, thus signing away any right to privacy of data you may still have. To maintain any privacy, you must use secrecy of your files and such. Keep your data secret so they can’t know what it is. Encrypt everything. But wait! That doesn’t work either, if you’re creating your data in Windows 10 Microsoft will keep records of what you’re doing, even if you are off line. Note that reportedly, Windows 10 will:

    All text typed on the keyboard is stored in temporary files, and sent (once per 30 mins) to:

    Telemetry is sent once per 5 minutes, to:

    Typing the name of any popular movie into your local file search starts a telemetry process that indexes all media files on your computer and transmits [the index] to:

    When a webcam is first enabled, ~35mb of data gets immediately transmitted to:

    Everything that is said into an enabled microphone is immediately transmitted to:

    And, that’s likely not a comprehensive list, as there is nothing there about how Microsoft gets your email and other private communications content, and the content of your private folders.

    Do you want that? Doesn’t that seem a bit an over the top thing for Microsoft to be doing? Does to me.

    This isn’t just the same old, same old cookie stuff to follow your browsing.

  10. I’ve ads popping up at the left bottom of my screen….. Even when I’m not connected to the internet… Pls help me…

  11. hack and tweak worked! Even for me and I didn’t know what a dword is or was ( I had to look it up)
    thank you for your clear and detailed instructions.

  12. Couple pointers in using Host file:
    1. If you have web site you wish to visit and you get site is blocked, this is caused by host file blocking the ad connected to link. The only fix is to edit host or convert back to old host. For editor of the Host file I like to use Notepad ++ because it will save the Host back into Windows\system32\drivers\etc folder. When you use Notepad, it save only to your Doc folder. Then you have to rename Host.txt to Host and copy the edited file to correct folder.

    2. Yes, the host file will block ads, malware calling home, and other problems. The easy way to update the host file is to download the zip and extract the files. Using File Explorer, I copy HOST file to c:\windows\system32\drivers\etc. I have noted in Notes the changes I made to HOST file so I can change the new file with my corrections. Again I use Notepad ++, this is same notepad programmers used to edit C+ or Python files.

  13. Thanks for this, i use Ad Block Plus and it works great (firefox) We need to find a way to use hotspot shield elite somehow, i remeber one program that resets trail period for programs but this one uses internet identification for it so no can do

  14. After installing quick heal internet security software, I have problem to close/quit my Tally ERP Accouting Software. If I remove Quickheal, Tally works okay. Now every time I have to go to task manager to quit tally. Another thing is tally takes little more time to load than before. I have done so much R & D to solve this. Discussed this issue with but not succeed. Even I have removed the windows firewall, then also this problem exists. Can you guide me what is the solution now?

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.