Click here to Skip to main content
12,291,230 members (57,428 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


18 bookmarked

Browse internet faster and save power using a smart HOSTS file

, 29 Dec 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Internet is full of flash ads nowadays that make page load slower, render slower and consumes more CPU, thus power. If you can browse without having any flash ads or in fact any ads loaded and without any of the tracking scripts – you can browse much faster, scroll through pages much smoother

Internet is full of flash ads nowadays that make page load slower, render slower and consumes more CPU, thus power. If you can browse without having any flash ads or in fact any ads loaded and without any of the tracking scripts – you can browse much faster, scroll through pages much smoother and have more hours from your battery. Nowadays, most websites use scripts from various analytics sites that track your browsing habit, use IFRAME to load tracking and social networking widgets. All of these add considerable delay to page loading and make browser consume more CPU and bandwidth. If you can turn all of them off, browsing internet feels a lot smoother, faster and you get more work hours while running on battery.

Moreover, you don’t get distracted by the flashy ads and save your children and young family members from looking at foul things.

If we could get 10% of the total internet users (2bn as of Jan 2011) to save 10% CPU, power and bandwidth while browsing everyday, we could save mega watts of power everyday throughout the world!

Using this solution, you can prevent ads and tracking scripts, prevent malicious and porn websites.

How bad is it?

Let’s take an example on a popular website. The red boxes are Flash Ads (read power suckers).


Once we disable all ads and tracking scripts, here’s how it looks:



  Before After
Total Requests 111 100
Total Download Size 1.2 MB 0.98 MB
Page load time 4.34s 3.64


Not just during page loading, while you are on the page, doing nothing, just reading, browser continuously consumes CPU.





Before disabling the ads and tracking scripts, CPU is always around 20-25%. After disabling it is around 8-10%. The more CPU works, the more power it consumes. If you are running on battery, you can get at least 20% more time from your battery. If you have many tabs open all the time, you can save more.

Here’s how to save CPU, bandwidth and power

Go to this website and download the HOSTS file:

Follow the instruction to put the HOSTS file in your C:\Windows\System32\Drivers\etc folder.

Now go to Start Menu, type Notepad but do not hit enter. Right click on Notepad and select Run As Administrator.


Go to File menu and click Open.

Copy and paste this into the File Name and click OK.



Now go to Edit menu and select Replace. Put in Find box and put in Replace box. Click Replace All.


Once done, you need to type back for the first entry localhost.


Remember, localhost cannot be

When you have done this correctly, it will look like this.


Save the file and exit Notepad.

Then go to Start menu and type: services.msc

From the service list, double click on “DNS Client”.


First click “Stop” to stop the service.

Then from the Startup Type dropdown, select Disabled.

Click OK.


Close all your browsers and reopen them. I highly recommend restarting your PC.

You are ready to browse faster, smarter, cheaper! 

I also highly recommend everyone to use OpenDNS. You can save yourself from getting into malicious sites and being ripped off your bank balance, property, spouse and children. Just go to and follow the instruction. It is the best thing happened on the internet after Wikipedia!

How does the HOSTS file trick work?

Here’s how internet works. You type and it goes and finds out what is the IP address for this domain. First Windows checks a file called HOSTS. If it is not defined there, it will ask the DNS Server configured for your network to give it the IP for the domain so that it can connect to the webserver. If you put fake IP in HOSTS file, Windows will hand over fake IP to the browser and browser will connect to the fake IP. Thus by putting an invalid IP, we prevent browser or any application running on your PC from reaching the ads, tracker, malicious and porn websites.

Don’t forget to share this with your friends and families!

Digg This  Reddit This  Stumble Now!  Buzz This  Vote on DZone  Share on Facebook  Bookmark this on Delicious  Kick It on  Shout it  Share on LinkedIn  Bookmark this on Technorati  Post on Twitter  Google Buzz (aka. Google Reader)  


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Omar Al Zabir
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Maximc23-May-13 12:48
memberMaximc23-May-13 12:48 
GeneralMy vote of 5 Pin
Belial0926-Jul-12 21:22
memberBelial0926-Jul-12 21:22 
QuestionReplace to ? Pin
Michael Freidgeim14-Jan-12 12:51
memberMichael Freidgeim14-Jan-12 12:51 
QuestionCan't find the updated Hosts file Pin
Bruce Fulford4-Jan-12 9:24
memberBruce Fulford4-Jan-12 9:24 
AnswerRe: Can't find the updated Hosts file Pin
Omar Al Zabir4-Jan-12 10:21
mvpOmar Al Zabir4-Jan-12 10:21 
QuestionSpybot Entered Entries Pin
xiecsuk2-Jan-12 22:10
memberxiecsuk2-Jan-12 22:10 
My HOSTS file has many entries starting which have been added by Spybot Search and Destroy. Do I replace these as well, or leave them as they are?

GeneralMy vote of 5 Pin
fredatcodeproject31-Dec-11 15:28
memberfredatcodeproject31-Dec-11 15:28 
General2nd alternative Pin
sx20082-Jan-12 8:07
membersx20082-Jan-12 8:07 
GeneralRe: 2nd alternative Pin
fredatcodeproject3-Jan-12 0:34
memberfredatcodeproject3-Jan-12 0:34 
GeneralMy vote of 5 Pin
HamidYaseen30-Dec-11 20:34
memberHamidYaseen30-Dec-11 20:34 
GeneralMy vote of 5 Pin
Sridhar Patnayak29-Dec-11 19:31
memberSridhar Patnayak29-Dec-11 19:31 
GeneralMy Vote of 5 Pin
RaviRanjankr29-Dec-11 10:17
memberRaviRanjankr29-Dec-11 10:17 
GeneralMy vote of 5 Pin
JackDingler29-Dec-11 9:29
memberJackDingler29-Dec-11 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160518.1 | Last Updated 29 Dec 2011
Article Copyright 2011 by Omar Al Zabir
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid