Home » How To » How To Export & Import Single Windows Firewall Rule

How To Export & Import Single Windows Firewall Rule

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.

open registry editor from Windows 11 Start menu - dark

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.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy

go to FirewallPolicy folder in registry

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.

right-click on FirewallPolicy folder and select export
save FIrewallPolicy export as a reg file

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.

open reg file in notepad

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.

copy first three lines
paste copied three lines in new text file to export Windows firewall rule

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.

copy Windows firewall rule to export

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.

paste copied firewall rule in new text file

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.

export additional firewall rules to new text file

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.

click file save as option
save new text file as reg file

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.

import single Windows firewall rule

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:

Leave a Comment

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

Scroll to Top