How To Modify Hosts File To Block Websites In Android

Often Bosses use the host file on a PC to block certain websites that he doesn’t want his employees visiting to waste time on. Sometimes it is more important to block adult websites when kids are involved. You may block unsafe websites via the router and then no one will be able to visit those websites while connected to the WiFi network. Good chances are that kids will find a fix for this easily and that is data plan. They can simply use the cellular data to visit potentially harmful websites. Well, now you can edit the host file on Android and block those websites from ever loading on your device.

You will be editing the Android Host File which is a system file so definitely this guide is only for rooted devices. Also, pay attention to each step and we will be over with the process smoothly.

Also see: "Unfortunately Google Play Store has stopped working" [Fixed]

How to Edit the Host File on Android OS

To edit our Host file we will be using this tool called the Android Debug Bridge.You are required to download and install the ADB Utility on your PC to edit the host files on your Android mobile device.


After Installing ADB, Open the folder where ADB has been installed and then type CMD in the address bar. When in command prompt, type “adb devices” and then you will be able to see the list of devices attached to the PC.


You need to connect your smartphone with the PC via USB cable.

Now, type the following command in command prompt:

Adb pull/system/etc/hosts D:\hosts

You can replace the “D” with the letter of the drive on your PC where you want to copy the host file from Android.


Once the file is copies, execute it using the notepad application on your PC.

To add a website URL to be blocked simply type 127.0.11.1 www.websitename.comand save it.
Now we need to place this modified hosts file to the Android OS so that it can block access to the listed websites.


Type the following command in CMD prompt.

adb push D:\hosts /system/etc/

This command just replaced the default hosts file with the modified version of the file.

Try visiting the site that you listed and it will block you.


Posted in:



Liked us? Tell your friends on Facebook!