Introduction
macOS
Open Terminal and type sudo nano /etc/hosts. Then, press the return key. Type the password of the current administrator account. Edit the file as desired.
Windows
Open Notepad as an administrator. Open the C:\Windows\System32\drivers\etc\hosts file, and edit as desired.
Instructions
Jump to:
A: macOS
A2) In the Terminal window, type sudo nano /etc/hosts and press the return key on your keyboard:
A3) Type the password of the current administrator account on your Mac. Then, press return.
NOTE: The Terminal window will not display any indication that you are typing your password. Simply type your password as normal and press return.
A4) Make any necessary changes, and then press control+O on your keyboard to save the file.
TIP: You can navigate up, down, left, and right by using the arrow keys on your Mac's keyboard.
A5) At the bottom of the Terminal window, Terminal will ask you to confirm the file name to which to save the changes. Simply press return without making any changes to the default file name (/etc/hosts).
A6) You should see a confirmation at the bottom of Terminal that it wrote a certain number of lines of text to the file. Now, press control+X on your keyboard to exit the hosts file.
A7) In the Terminal window, type sudo killall -HUP mDNSResponder and press return.
B: Windows 11
B1) Click your Start button.
B2) Type Notepad into the search field, but do not press Enter.
B3) In the search results, right-click on Notepad and choose Run as administrator.
B4) If prompted by User Account Control, click Yes.
B5) Click File and choose Open.
B6) Navigate to C:\Windows\System32\drivers\etc. On the bottom right-hand corner, use the drop-down option to show All files.
B7) Open the hosts file.
B8) Make any necessary changes.
NOTE: Entries that begin with the pound sign (#) are for comments or examples. They act as if they are not there. For entries to work, do not use the pound sign (#).
B9) Click File and choose Save.
C: Windows 10
C1) Click your Start button.
C2) Type Notepad into the search field, but do not press Enter.
C3) In the search results, right-click on Notepad and choose Run as administrator.
C4) If prompted by User Account Control, click Yes.
C5) Click File and choose Open.
C6) Navigate to C:\Windows\System32\drivers\etc and open the hosts file.
TIP: Notepad might default to displaying .txt files only. Use the drop-down option on the bottom right to show All Files.
C7) Make any necessary changes.
NOTE: Entries that begin with the pound sign (#) are for comments or examples. They act as if they are not there. For entries to work, do not use the pound sign (#).
C8) Click File and choose Save.
Outcome
You have made any desired changes to the hosts file on your computer.