You can open the HOSTS file in any text edit such as NOTEPAD and make the changes.
If you want to block certain sites, for example to block www.google.com, open HOSTS file using notepad and add " 127.0.0.1 www.google.com " without double quotes at the end of the line. Save the HOSTS file and open your favorite browser and type " www.google.com " in address bar. Now you can see the message " Page cannot be found ". If you are still able to browse the Google page then restart the computer and again open the Google website in web browser. " 127.0.0.1 " is the loopback IP address also called as local address pointing to you own computer. In the above example you are directing IP address of the Google to your computer
" ping www.google.com " without double quotes to ping Google website to find the IP address.
You can increase the internet surfing speed by mapping IP addresses to host names. Usually IP addresses to host names resolving is done by DNS (Domain Naming Servers). Some times it takes time to resolve IP addresses to host names using DNS. If that is the case, then you can use HOSTS file to map IP addresses to host names. For example, if you want to map BING website to Google website IP address then get the IP address of www.google.co.in using PING in DOS window and type <IP address of Google> www.bing.com
It should look like " 126.96.36.199 www.bing.com " without double quotes. Here 188.8.131.52 is the IP address of www.google.co.in
Now when you type www.bing.com in the address bar of the browser it will direct to www.google.co.in
But remember the HOSTS file size is limited. You cannot add a big list to block or map the websites.
In Windows/95/98/ME, HOSTS file is located at C:\WINDOWS\HOSTS
In Windows NT/2000, HOSTS file is located at C:\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS
In WindowsXP Home/Pro , HOSTS file is located at C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
NOTE: Always remember to take backup of your original HOSTS file before making changes to it.