How to export and import individual firewall rules on Windows 11

You can export and import only specific firewall rules on Windows 11, and in this guide, you will learn how.

Windows 11 export firewall rule
Windows 11 export firewall rule

On Windows 11, the Microsoft Defender Firewall is a security feature that monitors incoming and outgoing network traffic to allow or block traffic depending on configured rules.

Although the default settings should be optimal for most users, you can create new custom rules to control the network access for apps and services. However, the Microsoft Defender Firewall settings, Command Prompt, or PowerShell do not provide an option to export a specific firewall rule.

In the case that you have to transfer a specific firewall rule to other devices without overwriting the current configuration, you can create a custom export file using the Registry and Notepad.

This guide will teach you the steps to export and import specific firewall rules on the same or other devices.

Export single firewall rule on Windows 11

On Windows 11, the only way to export a single firewall rule is to export all the rules and then modify the list to include only the rules you want to import using the Registry and Notepad.

Warning: Modifying the Windows Registry can cause serious problems if not used properly. It’s assumed you know what you’re doing and have created a full backup of your system before proceeding.

Export firewall rules from Registry

To export firewall rules from the Registry, use these steps:

  1. Open Start on Windows 11.

  2. Search for regedit and click the top result to open the Registry.

  3. Browse the following path:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
  4. Right-click the FirewallRules key and select the Export option.

    Registry export FirewallRules

  5. Type the name for the “.reg” file.

    Registry save reg file on Windows 11

  6. Click the Save button.

Once you complete the steps, the exported file will contain all the firewall rules. The next step is to open the exported file with Notepad to remove the entries you don’t need or create a new “.reg” file containing only the entries you want to import into another system.

Create firewall export with one rule

To export a single firewall rule on Windows 11, use these steps:

  1. Open File Explorer.

  2. Open the folder with the FirewallRules key export.

  3. Shift + Right-click the file and select the Edit option from the lecagy context menu.

    Registry file open with Notepad

  4. Select the first three lines of the file.

  5. Right-click the selection and select the Copy option.

    Registry firewallrules copy entries

  6. Click the New tab button to create a new Notepad file.

  7. Right-click and choose the Paste option.

    Registry file paste intro

  8. Switch back to the file containing the FirewallRules key export.

  9. Carefully select the line containing the firewall rules to export, right-click the selection, and click the Copy option.

    Registry file exporting single firewall rule

  10. Switch back to the new Notepad files containing the three new lines.

  11. Position the typing cursor below the third line.

  12. Right-click and choose the Paste option.

    Paste firewall rule custom configuration file

  13. Repeat steps 10 through 13 to export multiple firewall rules on Windows 11.

  14. Click the File menu.

  15. Click the Save as option.

  16. Select a descriptive file name for the export.

  17. Click the Save button.

After you complete the steps, you will have a file containing only the firewall rules you need.

Import single firewall rule on Windows 11

To import a single firewall rule, use these steps:

  1. Open File Explorer.

  2. Open the location containing the modified “.reg” file containing the firewall to import.

  3. Double-click the “.reg” file.

  4. Click the Yes button.

    Import single firewall rule on Windows 11

  5. Click the OK button.

Once you complete the steps, you can open the Microsoft Defender Firewall on Windows 11 with the Advanced Security console to confirm the rule has been added.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 14 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].