A user-friendly desktop GUI application for cleaning, managing, and editing the Windows hosts file.
This tool is designed to simplify the process of maintaining large blocklists, importing domains from firewall logs, and ensuring your hosts file is clean and efficient.
Paste this into an elevated PowerShell window:
irm "https://tinyurl.com/HostsFileGet" | iexEasily view and edit your entire hosts file in a simple text editor.
A powerful Clean function that automatically:
- Removes all comments and empty lines.
- Standardizes all entries to the
0.0.0.0 domain.comformat. - Fixes malformed entries (e.g.,
127.0.0.1, typos, missing IPs). - Strips wildcard prefixes (
*.) from domains. - Removes all duplicate entries (case-insensitive).
- Sorts the final list alphabetically.
Directly import dnsbl.log files from a pfSense firewall to quickly add blocked domains to your hosts file.
Search for entries containing a specific keyword (e.g., "tiktok") and choose exactly which ones to remove from an interactive list.
A one-click button to flush the Windows DNS cache (ipconfig /flushdns), making your changes take effect immediately.
- Automatically creates a backup (
hosts.txt) in the same directory before every save. - Warns if not run as an administrator.
- Asks for confirmation before saving an empty file or overwriting unsaved changes.
- Python 3.x: You must have Python installed on your system.
You can download it from python.org.
The easiest way to use this tool is with the automated launcher script. It will handle the entire setup process for you.
Download the Launcher:
-
Download and launch "PythonLauncher.ps1"
-
Run the Launcher: Right-click the PythonLauncher.ps1 file.
-
Select "Run with PowerShell".
The script will automatically request administrator permissions, install Python if needed, download the latest version of the tool, and launch it.
Because this tool modifies a system file, it must be run with administrator privileges.
If you already have Python installed:
-
Save the Script:
Save thehosts_editor.pyfile to a location on your computer (e.g., your Desktop). -
Open as Administrator:
- Click the Start Menu, type
cmdorpowershell. - Right-click the application and select “Run as administrator”.
- Click the Start Menu, type
-
Navigate to Directory:
In the administrator command window, use thecdcommand to navigate to the folder where you saved the script.Example if you saved it to your desktop:
-
Execute the Script:
Run the tool by typing the following command and pressing Enter:
- Save Changes: Overwrites the system hosts file with the content in the editor. Creates a backup first.
- Refresh: Reloads the hosts file from disk. It will warn you if you have unsaved changes.
- Import pfSense Log: Opens a file dialog to select a
.logfile. It extracts unique domains from the log and appends them to the editor for cleaning.
- Clean: The main all-in-one function. It applies all cleaning and formatting rules to the entire file. A preview window will show you all proposed changes.
- Deduplicate: A simpler function that only removes duplicate entries without changing formatting or removing comments.
- Flush DNS: Immediately clears your system's DNS cache.
- Enter Keyword: Type a keyword (e.g.,
facebook,google) into the text box. - Click "Remove": A new window will appear, listing only the entries that contain your keyword.
- Select Entries: By default, all found entries are checked for removal. Uncheck any you wish to keep.
- Confirm Removal: Click the "Confirm Removal" button to delete only the checked entries from the main editor.
This tool is designed for Windows environments and should be run with administrator rights to modify the system hosts file safely. Always back up your hosts file before making changes if using it outside this application.