To block certain sites, you do not need to spend money on special programs, you just need to change the settings of your router. If the websites you want to block are encrypted, use a free service like OpenDNS to filter the sites.
Steps
Method 1 of 2: Using a router

Step 1. Check if the site you want to block is encrypted
Most home routers cannot block access to encrypted (https:// prefix) websites. To determine if a site is encrypted, look for the padlock to the left of the site's address. If the sites you are trying to block are encrypted, skip to the next section.

Step 2. Open the router's configuration page
If the sites you want to block are not encrypted, block them by changing your router settings. To do this, open the router's configuration page in a web browser on your computer. Common router addresses are:
- Linksys / TP-Link / Zyxel -
- D-Link / Netgear -
- Xiaomi -
- ASUS -
- MikroTik -
- Ubiquiti -

Step 3. Enter your credentials
If you have not changed them, enter the credentials set by the router manufacturer. In most cases, you must enter “admin” (or nothing) for both the username and password. If you are unsure what credentials to enter, refer to the instructions for your router.

Step 4. Find the “URL Filtering” or “Blocking” section
The location of this option depends on the router model; you will most likely find it in the Firewall menu or in the Security section.

Step 5. Enter the URLs of the sites you want to block on the connected devices
Remember that you won't be able to block addresses with the https:// prefix, so this method is not as effective. Read about how to block an encrypted website in the next section.

Step 6. Save the settings
Click Save or Apply. The router will reboot; it will take about a minute.

Step 7. Try to open the sites whose addresses you added to the router settings
If sites open, they are most likely encrypted; in this case, use the OpenDNS service (go to the next section).
Method 2 of 2: Using OpenDNS (for encrypted sites)

Step 1. Subscribe to the free OpenDNS Home plan
To block certain sites, it is better to use the OpenDNS service than to change the router settings. This is due to the fact that most home routers do not block sites with the https:// prefix (encrypted sites), and there are more and more encrypted sites. OpenDNS can filter encrypted sites for all users on your network.
You can register for free at opendns.com/home-internet-security/

Step 2. Open the configuration page of your router
The router needs to be configured to use OpenDNS DNS servers to handle the sites you block. To do this, open the router's configuration page in a web browser on your computer. Common router addresses are:
- Linksys / TP-Link / Zyxel -
- D-Link / Netgear -
- Xiaomi -
- ASUS -
- MikroTik -
- Ubiquiti -

Step 3. Enter your credentials
Do this to get to the configuration page. If you have not changed your credentials, you must enter “admin” for both the username and the password (or do not enter anything).

Step 4. Find the “WAN” or “Internet” section
It is most likely found in the Basic Setup section.

Step 5. Disable automatic assignment of DNS servers
Do this to manually enter the correct DNS server addresses.

Step 6. Enter the addresses of the OpenDNS servers
Enter the following OpenDNS server addresses on two lines:
- 208.67.222.222
- 208.67.220.220

Step 7. Save the settings
Click Save or Apply. The router will reboot; it will take 1-2 minutes.

Step 8. Open the OpenDNS control panel
Go to opendns.com and sign in to your account. The OpenDNS control panel will open.

Step 9. Click on the “Settings” tab and enter the IP address of your home network
The IP address will be displayed at the top of the control panel. Enter this address in the “Add a network” field. In this case, OpenDNS will register traffic from your network and block sites.
You will have to verify your network with an email that will be sent to the email address you entered when registering with OpenDNS

Step 10. Open the "Web Content Filtering" section of the "Settings" tab
Now specify what content you want to block.

Step 11. Select one of the preset filtering levels (if you want)
Select “Low”, “Medium” or “High”. Please be aware that OpenDNS regularly updates its Blocked Content Lists.

Step 12. Add the sites you want to block to the Manage individual domains list
You can add up to 25 websites to this list. Make sure the "Always block" option is selected for each site.

Step 13. Clear the DNS cache
Do this for the new settings to take effect. The DNS cache of every device on your network will be cleared automatically for some time, but for the settings to take effect immediately, clear the cache manually:
- Windows - Press ⊞ Win + R and enter ipconfig / flushdns to clear the cache. Now check your filtering options.
- Mac OS X - Open a terminal window (located in the Utilities folder), type dscacheutil -flushcache to clear the cache, and then type sudo killall -HUP mDNSResponder to restart the DNS service. You will probably have to enter your administrator password.

Step 14. Try to open the sites whose addresses you added to the OpenDNS settings
If sites are being blocked, you will be taken to the OpenDNS "Blocked Site" page.