Home » How To » How to Prevent Any Program from Connecting to Internet in Windows

How To Block a Program From Accessing Internet on Windows 10 & 11

By default, any program on your PC can access the internet without any overt restrictions. While this is the default behavior, under certain circumstances, there might be a need for you to block a program from accessing the internet. On Windows, you can do that by creating an explicit outbound rule in the firewall. This tutorial shows you how to configure the Windows firewall to block a program from connecting to the internet. Let’s get started.

Note: You need administrative privileges to create, modify, and delete Windows Firewall rules.

Steps To Block a Program From Accessing the Internet

1. First, open the Start menu, search for Windows Defender Firewall, and click on the top result.

open Windows Firewall by searching for it in the Start menu

2. Once the firewall program opens, click the Advanced Settings link on the left sidebar.

click on advanced settings option

3. As you want to block a program from connecting to the internet, we need to create an outbound rule for that. Right-click on the Outbound Rules option and select New Rule.

right-click on outbound rule and select new rule

4. Select the Program radio option and click Next in the wizard.

select the program radio option

5. Now, select the This Program Path option, click the Browse button, select the application’s exe file, and click the Open button. This will add the program’s path to the blank field.

Note: Windows might use environment variables to indicate part of the path. It is normal. For example, you can see %ProgramFiles% being used for the Programs Files folder path.

click browse and select the program you want to block from accessing the internet

6. Under certain circumstances, the firewall rule won’t work with the environment variable path. So, replace the environment variable with the actual path. In my case, I replaced %ProgramFiles% with the actual path “C:\Program Files”. Click Next.

A quick tip: To convert an environment variable to the actual path, copy and paste it into the File Explorer’s address bar and press the Enter button. Now, click on the address bar and copy the path (press Ctrl + C). Once you have it, replace the env variable in the firewall wizard.

optionally replace environment variable with actual file path

7. Select the Block the connection option and click Next.

select block the connection

8. Select the Domain, Private, and Public checkboxes and click Next.

select all profiles and click next

9. Give the new firewall a name of your choice and click Finish.

give the new rule a name and click next

That is it. The new firewall rule to block the program from accessing the internet is created and activated. From now on, the target program cannot connect or access the internet.

firewall rule created and the program is blocked from accessing the internet

Unblock & Allow the Program to Access the Internet

If you want to allow the blocked program to access the internet, you can either temporarily or permanently unblock it by modifying or deleting the corresponding firewall rule. Here’s how to do it.

Temporary unblock the program:

If you want to allow the program to access the internet temporarily, you can disable the rule. To do that, find the firewall rule under Outbound Rules, right-click on it, and select Disable Rule.

When you are done, right-click on the rule and select Enable Rule to block it again.

disable firewall rule

Permanently unblock the program:

To permanently allow a blocked program to access the internet, you can delete the firewall rules. To delete the rule, find the firewall rule under Outbound Rules, right-click on it, and select Delete. Click Yes if you see a confirmation box.

delete firewall rule

And there you have it! It is that simple to block any program on your PC from accessing the internet. Keep in mind that this approach only works for regular win32 applications. If you want to block an app installed using the Microsoft Store, use the metered connection feature.

If you have any questions, comment below and we’ll answer.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top