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 banner To 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 following file: HOSTS.ZIP. All credits for this file go to the winhelp2002.mvps.org 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:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DnsCache\Parameters

    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.

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

  1. MDJ

    It‘s even worse than IE if it can‘t and won‘t support add-ons.

    Reply
    1. George

      It will, even better, addons from chrome and firefox :)

      Reply
    1. SaTaN

      I think your just a troll fag pineapple dork!

      Reply
  2. jose

    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!!

    Reply
    1. Sergey Tkachenko Post author

      32bit dword

      Reply
  3. Bob Fregan

    I can’t revert all changes made when I run it again ;_;

    Reply
  4. Ian

    What did i wrong? http://prntscr.com/7zfk4l Is that normal? [NOTE:I am Brazilian, so the language is Portuguese.]

    Reply
  5. Adrian Osuna

    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.

    Reply
  6. Ida Gayle

    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.

    Reply
    1. Mark

      I am in the same situation – can someone reply to help? Thank you.

      Reply
  7. blah blah

    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.

    Reply
    1. Paul

      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.

      Reply
      1. SaTaN

        And there goes the PRO corporate yuppie nerd fag!, There’s always one of those twats, which btw, ALWAYS seems to be a dumb asskisser jew jizz licker that always has to put it’s two cents in! … Microshit makes ENOUGH money on OS SALES, they ARE just being extra jew GREEDY with all the FORCED, unblockable and unremoveable ads, trackingware, spyware, bloatware and other bullshit they force upon us! Fags who SUPPORT a corporate society shall, deservingly, die by a corporate society!

        Reply
    2. thodoris

      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.

      Reply
  8. Harley Marri

    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?

    Reply
    1. Think idiot

      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.

      Reply
      1. Joe

        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 http://winhelp2002.mvps.org/ 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.

        Reply
  9. Andrei

    it’s work great. thanks

    Reply
  10. crabyrat

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

    Reply
  11. yc

    is the host file getting updated automatically? as we knew the more AD web came out daily

    Reply
    1. Joe

      No it is not automatically updated. I usually go to the http://winhelp2002.mvps.org/ about once a month an download the latest host file and install it again.

      Reply
  12. Mark

    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.

    Mark

    Reply
    1. Joe

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

      Reply
  13. dadwhiskers

    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:

    https://askleo.com/windows-10-privacy-oxymoron/?awt_l=59CPU&awt_m=IhBj7NgE_JdfbL

    http://www.techsupportalert.com/content/are-recent-patches-windows-78-letting-microsoft-spy-you.htm?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+gizmosbest+%28Gizmo%27s+Best-ever+Freeware%29

    http://www.wilderssecurity.com/threads/list-of-windows-7-telemetry-updates-to-avoid.379151/

    https://winaero.com/blog/telemetry-and-data-collection-are-coming-to-windows-7-and-windows-8-too/

    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:
    oca.telemetry.microsoft.com.nsatc.net
    pre.footprintpredict.com
    reports.wes.df.telemetry.microsoft.com

    Telemetry is sent once per 5 minutes, to:
    vortex.data.microsoft.com
    vortex-win.data.microsoft.com
    telecommand.telemetry.microsoft.com
    telecommand.telemetry.microsoft.com.nsatc.net
    oca.telemetry.microsoft.com
    oca.telemetry.microsoft.com.nsatc.net
    sqm.telemetry.microsoft.com
    sqm.telemetry.microsoft.com.nsatc.net

    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:
    df.telemetry.microsoft.com
    reports.wes.df.telemetry.microsoft.com
    cs1.wpc.v0cdn.net
    vortex-sandbox.data.microsoft.com
    pre.footprintpredict.com

    When a webcam is first enabled, ~35mb of data gets immediately transmitted to:
    oca.telemetry.microsoft.com
    oca.telemetry.microsoft.com.nsatc.net
    vortex-sandbox.data.microsoft.com
    i1.services.social.microsoft.com
    i1.services.social.microsoft.com.nsatc.net

    Everything that is said into an enabled microphone is immediately transmitted to:
    oca.telemetry.microsoft.com
    oca.telemetry.microsoft.com.nsatc.net
    vortex-sandbox.data.microsoft.com
    pre.footprintpredict.com
    i1.services.social.microsoft.com
    i1.services.social.microsoft.com.nsatc.net
    telemetry.appex.bing.net
    telemetry.urs.microsoft.com
    cs1.wpc.v0cdn.net
    statsfe1.ws.microsoft.com

    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.

    Reply
  14. muxquare

    It works like butter, Thanks man!!!

    Reply
  15. manuel

    http://adguard.com/?c=821091 it Works like a charm! Adguard, Works perfect for Microsoft edge, give it a try!

    Reply
  16. G. Vishvak

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

    Reply
    1. Sergey Tkachenko Post author

      Can you show a screenshot?

      Reply
  17. Kimberly

    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.

    Reply
    1. Sergey Tkachenko Post author

      you are welcome

      Reply
  18. John Reese

    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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.