How to Safely Edit the Hosts File in Windows (NO Notepad)

I use the Windows Hosts file while migrating servers, and I need to test that my site is working correctly on another IP address before making the changes to the DNS servers. Unfortunately, most tutorials tell you to modify the Hosts file using Notepad, which is dangerous because you can easily make syntax errors and break stuff. But thanks to Microsoft’s PowerToys tool, you can safely edit the Hosts file without opening Notepad and activating or deactivating rules.

Here’s a tutorial on how it works.

1: Download and Install Windows PowerToys

Microsoft’s official PowerToys tool is a fantastic app that I always use, and I particularly love the PowerToys Run tool that I use instead of the Windows start menu button. Amongst the many utilities, it also includes a Hosts file editor that sanitizes the dangerous task of modifying a key text configuration file.

You can install PowerToys in two ways;

  1. Using the Microsoft Store PowerToys app
  2. Download the .exe file from the GitHub page under “Assets”
Download Microsoft PowerToys from GitHub
Download Microsoft PowerToys from GitHub

Install the EXE file, and you’re done.

2: Launch the Hosts File Editor in Windows PowerToys

Launch Windows PowerToys, and on the right-hand side, click the “Hosts File Editor” as shown here:

Hosts File Editor in Windows PowerToys
Hosts File Editor in Windows PowerToys

Not all PowerToys modules are enabled by default, so first, ensure that the “Enable Hosts File Editor” toggle is enabled, and then click “Launch Host File Editor” as shown above.

3: Safely Edit your Hosts File

In the dialog box, you’ll see a list of entries that already exist in the Hosts file, and you can enable or disable them accordingly. If you’re doing this for the first time, then click the “New Entry” button on the top as shown here:

Add a New Entry to the Hosts File Editor Tool
Add a New Entry to the Hosts File Editor Tool

This will create a new form to associate an IP address with a domain name. In this example, I’m using my website name wp-tweaks.com and a random IP address:

Add the IP Address and Hostname to the Hosts File Editor
Add the IP Address and Hostname to the Hosts File Editor

Once you’re done, click the “Add” button, ensure your new Hosts entry is enabled, and you’re done! Once you’re through testing, repeat the above steps and disable the entry you created. No more messing around with Notepad, no worries of accidentally breaking stuff, and no need to navigate through complex folder structures to access the Hosts file.

As a bonus, you can now use the Windows PowerToys tool to spruce up your PC workflow. I highly recommend it!

Use ChatGPT AI for SEO Structured Data Schema!

Structured data has been a thorn in my side for years. There's always some syntax error or a line that doesn't validate. Often, there's a missing field like aggregaterating, and of course, Google keeps changing its recommendations. But with ChatGPT, … [Continue reading]

How to Preserve your Query String when Cloaking Affiliate Links

Earlier, I'd written about implementing SubID tracking of affiliate links on the Impact dashboard. However, to track link clicks in Google Analytics, I also cloak them with a predictable pattern. In addition, it doesn't look as ugly as affiliate … [Continue reading]

How to Test a Website on Higher Resolutions ( Firefox is BAD!)

If you develop your website on a small screen, you must test it on higher screen resolutions. A few days back, I got this message on my Google Analytics insights tab: "Your site performs below average for 1680x1050" Here's a … [Continue reading]

MS Paint is Really Good

Microsoft decided to "update" their software apps and kill MS Paint a while ago. Luckily for us, they reversed that decision. Here's a screenshot of what it looks like now: MS Paint was so Good that Microsoft Decided not to Kill it Here are the … [Continue reading]

How to Permanently Disable the Lenovo Caps Lock Indicator

One of the most annoying features of Lenovo laptops is the on-screen Caps Lock and Num Lock indicator that looks like this: Lenovo Caps Lock Indicator It distracts from our writing and needs to go! The Lenovo Caps Lock Indicator is Supposed … [Continue reading]

Google’s “Content Ideas” is Useful for Fleshing Out your Niche

This morning, I got an email from Google about their new, experimental "Content Ideas" tool on the Google Search Console. Here's a screenshot: Google Content Ideas Clicking the link, I saw this report: Long-Tailed Keywords for Topics in your … [Continue reading]

I Almost Fell for this Twitter Scam with a Fake ID!

Like most tech enthusiasts, I consider myself adept at spotting scams. But a few days back, I almost fell for a very dangerous Twitter scam, where a scammer impersonates someone and replies to you when you ask the original account a payment … [Continue reading]

Android App Tracking: Reddit and Google News are HORRIBLE!

Earlier this week, I downloaded and installed the DuckDuckGo app with App Tracking Protection in public beta, and what I found blew my mind. I naively thought that installing uBlock Origin on my mobile Firefox browser was enough. But I found that … [Continue reading]

Why You Should Update the Year in Page Titles: Ignore Mueller!

As we approach the end of the year, Google's John Mueller continues with the tradition of scaring us into not changing the page title to reflect the New Year. Take a look at his response to a tweet asking him about … [Continue reading]

WP-Tweaks