Editing your hosts file (the file that maps hostnames to IP addresses, for those of you who were previously unaware), is useful for everything from controlling access to websites and network traffic to just mapping addresses to names. Whether you're a developer looking to make some DNS tweaks or just a concerned parent looking to block certain sites from their kids, hosts file modifications have got you covered.

You can go about this process in two ways, depending on whether or not your Android device of choosing is rooted. While the process isn't exactly rocket science on a non-rooted device either, it's definitely more straightforward on devices that have been rooted.

The non-root method

For this method, you will require a computer with the Android Debug Bridge (or ADB) installed on it. If you don't already have ADB, you can grab it from Google's developer resource page. Install ADB, and then run a command prompt in ADB's installation directory.

  1. Connect your device to your computer via USB (make sure you've already enabled USB debugging in the developer settings). Run the command
    adb devices
    to ensure your device is connected, and that ADB is reading and interacting with your device appropriately.

  2. Download your hosts file from your device by issuing the command
    adb pull /system/etc/hosts F:\hosts
    (replace F:\ with the directory you wish to copy your hosts file to)
    This will copy your hosts file to your computer, to allow you to edit it in Notepad.

  3. Now, simply navigate to the directory which you copied the hosts file to, and edit away! Remember, once you're done you need to push the file back to your device. Issue the command:
    adb push F:\hosts /system/etc/
    (Again, replace F:\ with the directory where you're storing your hosts file)
    and you're good to go.

The root method

This method is nowhere near as lengthy and should take you less than 5 minutes, even if you're a slow tapper.

  1. Open your file manager of choice (we recommend a file manager like Solid Explorer, as it allows for easy adjustments and modifications to read and write permissions.

  2. Navigate to the /system/etc directory.

  3. Locate the hosts file in this directory and long-press it to open the "Properties" menu.

  4. Select the "Change" option in the permissions section.

  5. Select "Group" under write permissions. You should now have sufficient permissions to modify and overwrite the hosts file.

  6. Reboot your device and navigate to the hosts file again using your file manager. Select it, press "More" and tap the "Open" option. (You will need a text editor with Superuser access, like TurboEditor.

  7. Make any changes you wish, save the file and you're set!

Ok, that's all good but what can I actually do by modifying my hosts file?

A whole host of interesting things (excuse the pun). Everything from speeding up lookups for specific servers with static IPs by adding a custom host to restricting certain servers from sending info to and from your phone – hosts file modifications have it all. There are more specific guides on modifying your hosts file for specific purposes all over the web – this is a fairly universal element across operating systems so there's no lack of available aid.

What do you guys think? Will you be modding your hosts file, and if so, why? Let us know in the comments, or tell us your thoughts over in our forums.

We may earn a commission for purchases using our links. Learn more.