This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 85,939 times.
Learn more...
The Windows Hosts file is a system file you can edit to map hostnames or servers to IP addresses. Most people won't ever need to edit this file, but sometimes certain apps and services require making some changes. This wikiHow teaches you how to open, edit, and save the Windows Hosts file.
Steps
-
Press the Windows key on your keyboard. This opens the Windows menu and the search bar.
-
Type notepad into the search bar. Don't click anything yet—just type the word and wait for the search results to appear.Advertisement
-
Right-click Notepad in the search results. A menu will expand.
-
Click Run as administrator. This opens Notepad as an administrator.
- You may have to click Yes on a security warning to open the app.
-
Click the File menu and select Open. This opens your file chooser.
-
Navigate to the path that contains the hosts file. The hosts file is located at c:\Windows\System32\Drivers\etc. You can paste that path into the bar at the top of the window and press Enter to go there.
-
Select All Files from the drop-down menu. It's the menu toward the bottom-right corner of the window. You should now see a handful of files, including the hosts file.
-
Select the hosts file and click Open. The hosts file is now open for editing.
-
Make changes to the file. Now that the file is open, you can add the correct lines to the file.
- When you add a line to the hosts file, you'll want to enter the IP address first, followed by the domain name you're mapping it to. Separate the two with a space or a tab, and keep each entry on its own line.[1]
- Lines that begin with a hash symbol # are considered comments, which means they are not active. Instead of deleting a line, just add a hash symbol to the beginning. This way you can easily reactivate old entries if you accidentally disable something you needed.
-
Click the File menu and select Save. This saves your changes to the hosts file.
Video
Expert Q&A
Tips
-
Always back up the file before editing.Thanks
-
You need administrator rights to do this.Thanks
Warnings
- Be careful deleting the old Hosts File! You may end up accidentally deleting your new one and losing your edits!Thanks
- Make sure to scan your computer and remove the bad program either before or after doing this.Thanks
About This Article
1. Open Notepad as an administrator.
2. Go to File > Open.
3. Go to c:\Windows\System32\Drivers\etc.
4. Select All Files from the drop-down menu.
5. Select the hosts file and click Open.
6. Make your changes.
7. Click File > Save.