Block ads on your computer and smartphone

Do you like ads in your browser? In Skype? In your phone’s apps? No? Well, there’s a way to get rid of them, and I’ll show you how. This works on computers (Windows, Mac, Linux) and even on Android phones! It probably works on iPhones too, if you can figure out how to get access to the system files.

The idea

You don’t need to use a particular program, or browser extension, or toolbar. The trick is in the very nature of how computer networks work. To put it simply, every computer (and smartphone) has a file that tells where to look for Internet addresses, and we can take advantage of that by adding fake addresses for ad providers.

When the computer wants to fetch an ad, it will now pick up our fake address and it won’t receive an ad, so it can’t show it to us. Mission accomplished!

Caveat: This trick relies on changing the address of ad networks. Ads that a website might serve from its own server (like an online newspaper might) are not blocked by this. If we’d block the newspaper, we wouldn’t be able to read the articles either.

Smart people have already created long lists of known ad providers for us, and for each ad provider there’s a fake address in the list. All we need to do is grab that file and put it on your machine. It sounds simple, and it is. It’s just a matter of knowing where it needs to go, and getting write permission to that location.

Tip: You can use the same file to block any unwanted regular websites, for instance if you tend to procrastinate or if you want to block adult sites.

The solution

The crucial file is called simply hosts without any extension (more on Wikipedia). Here’s my hosts file that I put together from two large lists. To use this file, follow these steps:

Windows

  1. Download the hosts file and rename it to just “hosts” (remove the .txt extension).
  2. Find the original hosts file:
    c:\windows\system32\drivers\etc\hosts
  3. Rename the original file to e.g. “hosts.bak”.
  4. Copy the new file to this location.
  5. The new file takes effect immediately.

Linux/Android

  1. Download the hosts file and rename it to just “hosts” (remove the .txt extension).
  2. Find the original hosts file: /etc/hosts
  3. Rename the original file to e.g. “/etc/hosts.bak”:
    sudo mv /etc/hosts /etc/hosts.bak
  4. Copy the new file to this location:
    sudo cp ~/Downloads/hosts.txt /etc/hosts
  5. The new file takes effect immediately.

Apple OS X and iOS

  1. Download the hosts file and rename it to just “hosts” (remove the .txt extension).
  2. Find the original hosts file: /private/etc/hosts
    • On iOS, you need use a file manager that can view system files.
    • If your device isn’t already jailbroken, let Google help you with that.
  3. Rename the original file to e.g. “/private/etc/hosts.bak”:
    sudo mv /private/etc/hosts /private/etc/hosts.bak
  4. Copy the new file to this location:
    sudo cp ~/Downloads/hosts.txt /private/etc/hosts
  5. The new file takes effect immediately.

 

Disclaimer: As always, don’t mess with your system unless you understand what you’re doing. I offer the above information without warranty or support.

1 Response to “Block ads on your computer and smartphone”


Leave a Reply




%d bloggers like this: