Windows Firewall is the default network security application that monitors and controls all incoming and outgoing network traffic. If you want Windows Firewall to function in a specific way, you can create custom firewall rules. For example, you can allow pings through Windows Firewall or open a specific port by creating a simple rule.
Once you create a firewall rule, wouldn’t it be nice to be able to export it? That way, you don’t have to reconfigure the rule in case you want to reuse it on a secondary machine or when you reinstall the OS. Additionally, exporting an individual firewall rule lets you import it without overriding the current configuration.
The problem is that while you can export/backup all firewall rules, there is no obvious option to export or import an individual rule. However, with a simple trick, you can export and import a single Windows Firewall rule. This guide shows you how. Follow the steps.
Export single firewall rule on Windows 11
To backup/export an individual Windows Firewall rule, you have to extract it from the registry and save it as a .reg file. Sound pretty complicated but it is really easy. Follow the steps below.
Step 1: Open the Registry Editor on Windows 11.
Click/tap on the start icon on the taskbar, type Registry Editor, and click on the top result to open Windows Registry Editor. You can also use the regedit Run command.
Step 2: Go to the FirewallPolicy folder under HKEY_LOCAL_MACHINE.
Once the Registry Editor window opens, paste the below path in the registry address bar and press Enter on your keyboard. This takes you to the FirewallPolicy folder. This folder has all the registry values for each and every firewall rule.
Step 3: Export the FirewallPolicy key in Registry.
Right-click on the FirewallPolicy folder and choose the “Export” option. Choose a destination folder, type a name of your choice in the File Name field, set the save as type to “registration files (*.reg)” and press the Save button. This will save the FirewallPolicy folder as a .reg file. Effectively, you’ve backed up the registry.
Step 4: Open the exported .reg file with Notepad.
After saving the .reg file, right-click on it and choose the Open with > Notepad option. If there is no Notepad option, click on “Choose another app,” select Notepad from the list of options and press the “Always” or “Just once” button.
Step 5: Copy the first three lines in the .reg file to a new text file.
Now, copy the first three lines in the file. To copy, select the first three lines with your mouse cursor, right-click, and select “Copy.” Next, open a new tab in Notepad and paste the copied text by right-clicking and selecting Paste or pressing Ctrl + V.
Note: You can also create a new text file on the desktop (right-click > new > text file), open it, and then paste the copied text.
Step 6: Find and copy the firewall rule you want to export/backup.
After that, go back to the exported reg file in Notepad. Next, find the rule you want to export. Each rule has a description and name. Use the Find (Ctrl + F) window in Notepad to quickly search for the firewall rule you want to export. Once you find the rule you want to export, select the entire rule including quotes (“”), right-click, and click on “Copy” to copy the rule to the clipboard.
Note: Maximizing the Notepad window allows you to see and copy the entire firewall rule.
Step 7: Paste the copied rule in the new text file right under the first three lines.
Go back to the new text file and paste the copied rule right under the first three lines of text. To paste, right-click and select Paste or press Ctrl + V.
Note: To export multiple individual firewall rules, copy them and paste each of them into a new line. Take a look at the image below for reference.
Step 8: Save the new text file as a .reg file.
After adding all the rules to the new text file, select the File > Save as option (Ctrl + Shift + S). Go to a folder where you want to save the file, type the name of your choice in the File name field, set Save as type to “All files (*.*)”, and press the Save button.
This action saves the text file as .reg (registration) file in the chosen location. You can use this file to import select firewall rules and avoid overriding the entire firewall configuration. That is it. With that, you’ve exported a single firewall rule on Windows 11.
Import single firewall rule on Windows 11
To export a single Windows Firewall rule, follow the steps outlined below.
Step 1: Find the exported .reg file in File Explorer.
First of all, open the File Explorer (Win + I) window on your computer. Next, navigate to the folder where you saved the firewall rules .reg file.
Step 2: Double-click on the .reg file and click Yes.
Once you find the .reg file with an exported firewall rule, double-click on it. This initiates the merging process of the .reg file with the Windows Registry. When prompted, click/tap the “Yes” and “OK” buttons.
That is it. With that, you’ve imported the single firewall rule on Windows 11.
I hope this guide helped you in exporting and importing individual Windows Firewall rules.
If you are stuck or need help, send an email, and I will try to help as much as possible.
Related Windows Firewall how-to guides:
- How to reset Windows Firewall to default
- How to block a program in Windows Firewall
- How to allow a program in Windows Firewall
- How to block a website or IP address in Windows Firewall
- How to disable Windows Firewall
- How to block all outgoing connections/traffic using Windows Firewall
- How to prevent a program from connecting to internet using Windows Firewall