Sponsor - Click for samples, and more offers
Sponsors - Click for samples, personalization, and more offers

You, Too, Can Hack (Part 1)

Don't Worry, It's Legal

5/22/2025 | Bits & Bytes

In the tech world, “hacking” is often referenced with derision – I, myself, am guilty of doing so here at Bits & Bytes – but really it’s just a term for getting a computer or a system or a network to do something it wasn’t initially intended to do. Hacking isn’t always done with an evil sneer and a sinister twirling of the mustache; there are simple, mostly benign hacks that anyone can do, and they usually come in the form of neat little tricks. For the next few months, Bits & Bytes will be sneaking “behind the curtain” to show you how some of these tricks are done in a new series of articles titled “You, Too, Can Hack.”


You, Too, Can Hack (Part 1): The Windows Hosts File

Nestled quietly in an obscure folder on your computer’s hard drive sits the hosts file— a simple text file lets you control how your computer finds websites on the internet. There’s rarely a reason for anyone to ever interact with this file, but for those who know what they’re doing, the hosts file can do some neat things like block distracting sites, test local webpages, and even improve security. Or, if you happen to have access to a loved one’s computer, it can lead to some pretty good pranks. So I’ve heard, anyway (ahem).


What Is the Hosts File?

You can think of the hosts file as a phone book for your computer. But instead of phone numbers, it contains a list of domain names (like www.example.com) and their matching IP addresses. When you type a website’s name into your browser, Windows first checks this file before asking your internet service for directions. If it finds a match, your computer connects directly using the provided IP address instead of the IP it should be using. This feature gives you the ability to override normal internet lookups with your custom settings, which can come in handy in certain situations.


On a Windows machine, the hosts file is located at:

C:\Windows\System32\drivers\etc\hosts


Because it’s a critical system file, you’ll need administrative privileges to edit it. Most text editors like Notepad can work, but remember to "Run as Administrator" for any changes to stick. And just as a heads up, if you’re interested in playing around with the hosts file, I’d suggest making a copy of the original hosts file before making changes just in case. Changing your hosts file can have handy benefits, but overdoing it might lead to unexpected results, so keep it neat and well-documented.


How Does It Work?

The hosts file operates as a set of rules, with each line in the file containing an IP address and a domain formatted like so:


127.0.0.1    www.example.com


Note that there should always be at least one space or tab between the IP address and domain on each line. 


In this case, 127.0.0.1 is a special IP address that always points back to your own computer. When you set this rule, any time you then try to visit the web site www.example.com, your computer will find the IP address in the hosts file and loop back to itself instead of fetching the real site; this essentially blocks access to that website.


Thus, one common use for the hosts file is blocking websites that distract you or that you feel could compromise your productivity (or even your security). For instance, if you’re looking for a way to prevent yourself from falling down a social media rabbit hole during work hours, you can redirect those sites to a harmless local address.


How to Block a Website

Once you’ve opened the hosts file as an administrator, add one new line to the bottom of the file for each site you want to block. For example, to block Facebook and Reddit, you would add the following (remembering to put a space or tab between the IP address and domain):


127.0.0.1    www.facebook.com

127.0.0.1    www.reddit.com


After saving your changes, you can flush your local DNS cache to make sure that Windows uses your updated hosts file immediately. To do this, open a Command Prompt as an administrator (type “cmd” into search and select “Run as administrator”) and then use the following command:


ipconfig /flushdns


Now, when you try to visit these sites, your browser will be unable to connect—giving you a productivity boost without any extra software.


Other Uses

If you’re a developer, you can use the hosts file to map a custom domain name to a local server address. This can make testing local web projects easier before they actually go live.


You can also preemptively block hosting sites known for malware or phishing attempts by simply redirecting them to 127.0.0.1.


I’ve also heard that if you create a dummy site for a well-known search engine that only returns search results with your mom’s name and picture, you can use the hosts file to make sure she gets redirected to that dummy site no matter what browser she’s using. Supposedly, that kind of thing can really freak people out, so I don’t recommend trying it out. Indeed, definitely do not edit your mom’s hosts file to make her think Google is taking over her computer.


I’ll be back next month with Part 2 of “You, Too, Can Hack”. Stay out of trouble.


Next up from Bits & Bytes...

Current Events: 4chan Hacked

The Importance of Cybersecurity

(In)famous Computer Viruses

Lessons from Digital Disasters
Latest from PromoJournal...

Episode 548 with Peter Wilken

The 10 Commandments of Branding

5 Tips for Approaching Customers

Are you selling the end result?

Beach Towels

Picks of the Week
X