Block Thousands of Ads With HOSTS





Introduction: Block Thousands of Ads With HOSTS

In this instructable, I will show you an easy way to block nearly thousands of advertisements, in one simple, easy method.

Step 1: About Window's HOSTS File

Before we start, it is important to understand exactly what the HOSTS file is.

The HOSTS file is a file with IP addresses, corresponding to a domain name, that windows references and bypasses DNS with.

For a more in-depth explanation, please visit Wikipedia's definition:

Step 2: Download Replacement HOSTS File

There are many replacement HOSTS file out there, so experiment and determine which one you like best. I personally use the MVPS malware prevention HOSTS file. It does fine for me.

The MVPS HOSTS file I've used is located here:

Simply save this file to your desktop, temporarily.
(Right-Click, Save Target/Link As..)

Step 3: Navigate to and Backup Default HOSTS File

Our next step is to find the HOSTS file on your computer.

Here are some of the default locations for the Windows HOSTS file from Wikipedia.

  • Linux and other Unix-like operating systems: /etc
  • Windows 95/98/Me: %windir%\
  • Windows NT/2000/XP/Vista: %SystemRoot%\system32\drivers\etc\ is the default location, which may be changed. The actual directory is determined by the Registry key \HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath .
  • Mac OS: System Folder:Preferences or System folder (format of the file may vary from Windows and Linux counterparts)
  • Mac OS X: /private/etc (uses BSD-style hosts file)
  • OS/2 and eComStation: "bootdrive":\mptn\etc\
  • Novell Netware: SYS:\ETC

If you can't find it, Start -> Search is always a good tool to use :).

Once you successfully navigate to the HOSTS file, rename is from "HOSTS" to "HOSTS.backup".
Doing this, you will always have a backup of your default HOSTS file if for some reason you want to revert to it.

Step 4: Copy New HOSTS File

Next, copy and paste the "HOSTS.txt" file from you desktop to where your default HOSTS file was.
After the file is copied, rename it from "HOSTS.txt" to just "HOSTS".

NOTE: You maybe have to edit your folder settings to not "Hide extensions for known file types" by going to Tools -> Folder Options -> View -> Uncheck "Hide extensions for known file types".

Step 5: Finish!

You have now replaced your HOSTS file!

It may take a few minutes for the changes to become active. You may also have to close all internet browser windows.

Enjoy internet browsing with minimal ads!



    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest

    17 Discussions

    If you are using firefox, get the Adblock extension. If you are using IE, get Firefox, then get Adblock.

    4 replies

    But the good thing about this, is that It works for ANY browser.
    Not saying that firefox is bad...

    If you are using IE, get Firefox, then get Adblockhahahahaha, 1 problem i cant hahahahahahahahalol

    I can't agree more with Purgedsoul. I have Firefox (w/ Adblock Plus of course!) and it works like a charm. You might get the noscript extension too so you can visit sites that block Firefox (they don't like the ads bypassed!).

    I am not an expert, so do correct me if I"m wrong.

    Having a large host file can slow a PC down to a crawl.
    Use Peerguardian instead ( without logging)

    I do keep <10 entries in the host file for an absolute deny policy.

    Sometimes, I'll be attacked: My DNS will be changed and Peerguardian (PG) blocks all connections. I examine the address PG is block and put it in my hosts file. If possible, try to remember the site that started everything and block that too.

    So - my opinion: keep the hosts file small (unless maybe its on another (*nix ) machine)[proxy?]

    1 reply

    I agree 100% Back when I did this, i meant for it to be a quick & easy fix.


    11 years ago

    should of known how to do that. it looks for .... and replaces it with but, if you set apache up to broadcast on, does that mean your site will become the ad? yes think so

    1 reply

    Yes. If you didn't want this to happen, you could always use spinach_dip 's suggestion: "try using instead of"

    Yeah, I learned how to do this a year or two ago, and it's nice that there's no ads, but the "This page can not be displayed" things all over can still be a bit annoying. This method is also great for pranking people! Just redirect one site to another... It'll really confuse people!

    1 reply

    set up a local server to display what ever you want!

    I just block (and Those are the only "intelligent" popups I run into. (The "intelligent" popups popup when you click on something, bypassing most popup blockers.)


    11 years ago

    Also, if you have a DNS server that you have access to, you can add entries there instead of your hosts file, making the changes noticeable for your whole network, or whatever is connecting to your DNS server. Brett

    try using instead of

    This is a good deal. I've actually switch to using Adblock + Filterset G updater + my own custom block list. I've done this because it's more flexible, and I can disable it instantly without a reboot or restart of my browser. However, I've started using the Hosts file again because of my stand alone Aggregator was, with all the ads, turning into an aggravator. It's just targeted a bit better.