How to block ads using a HOSTS file

In this tutorial i will show you how to block ads, banners, make web sites load faster and save on bandwidth using the built in Windows/Linux OS’s HOSTS file.

What is a HOSTS file:

A HOSTS file is a file that is located in a Windows or Linux/Unix file system, it will usually be located under:

For Windows:


For Linux/Unix:


a sample of a HOSTS file will look like this:

this means that every request from your PC to will be redirected to, which is a non-routable meta-address. so, for example, lets say that you are browsing to, in site there are banners coming from, these banners will not be displayed in your browser because the request will be redirected to your a non-routable meta-address which returns nothing.

How to do it:

  1. Go to this site
  2. Click the link and download the file to your Desktop
  3. Extract the zip file to you Desktop
  4. Go to the HOSTS file location in your OS, /etc for Linux or \drivers\etc for windows and backup your original HOSTS file, you can rename it to HOSTS.orig
  5. You can double click the mvps.bat file for an automated process or you can manually copy the HOSTS file inside the zip to the desired location according to your OS, Windows or Linux
  6. Open a CMD window and type ipconfig /flushdns. this will flush the DNS cache, the DNS cache stores IP addresses and their respective web name address. for the OS to refresh the changes that you’ve made to the HOSTS file you need to run this command
  7. Optional: you can open your new HOSTS file using any notepad application, like Notepad++ and add any web address you want and ( <AnyWebAddress>), this will make this address invalid untill you delete this entry from the HOSTS file
Tagged with: ,
Posted in Computers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: