In this guide, we will show you the steps to edit the Hosts file on your Android device. There could be quite a few reasons why you might want to carry out this task, primary among them is the ability to block the websites of your choice [by using a loopback IP 127.0.0.1]. However, making changes to this Hosts file is no longer an easy task, due to the fact that the system partition is now read-only.
With that said, there does exist a couple of nifty methods that will help you edit the Hosts file on your Android device. The first and obvious method is by making the system partition writeable which will then give you access to easily make any changes to the file present in the system partition, including the Hosts file.
The second method is via a module, which in simplest terms. creates a copy of the Hosts file outside the system partition which will then allow to make changes to the Hosts file even if the system is read-only. We have explained both these methods in this guide, so without further ado, let’s check them out.
Table of Contents
How to Edit Hosts File on Android
Go through both of the methods once and then try out the one which is in sync with your requirement. Also, take a backup of your data beforehand, just to be on the safer side. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.
Method 1: Edit Android Hosts File By Making System Partition Read-Write
This is the more complicated of the two methods but it’s just a one-time effort. Once you have made the system partition r/w, you could then easily make changes to the files present in that partition without any additional subsequent setup.
- First off, root your device via Magisk.
- Then refer to this guide and make the system partition r/w.
- Once done, download and install a root-supported file explorer.
- Then launch it, tap on the hamburger menu, and select Root.
- You’ll get a Magisk prompt, tap Allow. Then go to this location:
/system/etc/hosts
- Now open the Hosts file and carry out the desired changes.
- Once done, save the changes and restart your device. That’s it.
Method 2: Edit Android Hosts File via Systemless Hosts Module
- First off, root your device via Magisk.
- Then launch Magisk, tap on settings, and tap on Systemless Hosts.
- The module will be added. Restart your device to enable it.
- Then download and install a root-supported file explorer.
- Then launch it, tap on the hamburger menu, and select Root.
- You’ll get a Magisk prompt, tap Allow. Then go to this location:
/data/adb/modules/hosts/system/etc/hosts
- Now open the Hosts file and carry out the desired changes.
- Once done, save the changes and restart your device.
That’s it. These were the steps to edit the Hosts file on your Android device. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.