Every operating system contains a system of host files, or plain text files that are referenced by an operating system to map hostnames to IP addresses. Also known as hosts, these files can also be used to block any website on your computer or network.
In this tutorial, you will learn how to block any website of your choice on both Windows and Mac. All you will need to do this is a text-editing application such as Notepad or TextEdit.
How To Block a Website on Windows
Open the Windows File Explorer and type C:/Windows/System32/drivers/etc into the URL bar. Then press Enter.
This will bring up your host file. Double-click on the file and select Notepad to open it. Next, place your cursor at the end of entry 127.0.0.1 localhost or ::1 localhost and press Enter to create a new entry.
Enter 127.0.0.1 followed by a space, and then type the website address that you would like to block (e.g. 127.0.0.1 facebook.com). Press Enter and then repeat the process with all of the sites you'd like to block.
Click File and select Save. If a message appears asking if you'd like to activate your administrator permissions to save the file, click No. Next, right-click on the host file and select Properties. Head to the Security tab, select your user account, and enable the permissions so that you can save the file as an administrator.
How To Block a Website on Mac
Head to Applications > Utilities > Terminal. Next, enter /bin/cp /etc/hosts /etc/hosts-original and press Enter.
Enter your password and press Enter. Next, enter the command / Applications / TextEdit.app / Contents / MacOS / TextEdit / etc / hosts and press Enter. Your host file will open with TextEdit. If the file is locked, click Lock and then select Unlock.
Next, place your cursor at the end of entry fe80 :: 1% lo0 localhost and press Enter.
Enter 127.0.0.1 followed by a space, and then type the address of the site you want to block (e.g. 127.0.0.1 twitter.com. Press Enter and repeat the procedure with all websites you would like to block.