Windows 10 firewall export rules and import

How to export and import firewall rules on Windows 10

Yes, you can export and import all your firewall rules to the same or another computer, and here's how to do it on Windows 10.

On Windows 10, the Windows Defender Firewall is a security feature that checks incoming and outgoing network traffic and allows or blocks specific traffic depending on predefined rules.

Although every installation of Windows 10 comes with the same set of default rules, you can always create new custom rules to allow or block apps from accessing the network. If you have created multiple firewall rules, and you don’t want to lose you settings after a clean installation, or you want configure other devices with the same policy, you can export and import the Windows Defender Firewall rules using the advanced settings console and Command Prompt.

In this guide, you’ll learn the steps to export the current list of firewall rules as well as the steps to import the rules to a new installation of Windows 10.

How to export and import firewall rules using Windows Security

If you want to backup all the Windows 10 firewall rules, so you can then restore to another installation, you can use the Windows Security app.

Backing up firewall rules

To export firewall rules using Windows Security, use these steps:

  1. Open Windows Security.

  2. Click on Firewall & network protection.

  3. Click the Advanced settings option.

    Windows Security firewall advanced settings option
    Windows Security firewall advanced settings option
  4. Right-click the Windows Defender Firewall with Advanced Security on Local Computer item and select the Export Policy option.

    Windows 10 firewall export rules option
    Windows 10 firewall export rules option
  5. Select a location to store the list.

  6. Type a descriptive name for the list – for example, firewall-rules.

    Export firewall rules to wfw file
    Export firewall rules to wfw file
  7. Click the Save button.

  8. Click the OK button.

Once you complete the steps, the firewall rules will export in the wfw file that you can easily import to the same or different computer.

Restoring firewall rules

To import firewall rules from an exported file, use these steps:

  1. Open Windows Security.

  2. Click on Firewall & network protection.

  3. Click the Advanced settings option.

    Windows Security firewall advanced settings option
    Windows Security firewall advanced settings option
  4. Right-click the Windows Defender Firewall with Advanced Security on Local Computer item and select the Import Policy option.

    Windows 10 firewall import rules option
    Windows 10 firewall import rules option
  5. Click the Yes button to confirm that importing a policy will overwrite all the current rules.

  6. Select the .wfw file.

    Import firewall rules to wfw file
    Import firewall rules to wfw file
  7. Click the Open button.

  8. Click the OK button.

After you complete the steps, the policy will overwrite the current rules with the ones in the .wfw file.

How to export and import firewall rules using Command Prompt

Alternatively, you can also export and import firewall rules on Windows 10 using Command Prompt.

Exporting firewall rules

To export the current firewall policy using Command Prompt, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to export the Windows Defender Firewall rules and press Enter:

    netsh advfirewall export "C:\firewall-rules.wfw"

    Export firewall rules using netsh command
    Export firewall rules using netsh command

Once you complete the steps, all the firewall rules will be exported to a .wfw, which you can then import on another installation of Windows 10.

Importing firewall rules

To import firewall rules on Windows 10 with Command Prompt, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to export the Windows Defender Firewall rules and press Enter:

    netsh advfirewall import "C:\firewall-rules.wfw"

    Import firewall rules using netsh command
    Import firewall rules using netsh command

After you complete the steps, the firewall rules will import overwriting the device current policy settings.

We’re using Command Prompt, but you can also use the commands on PowerShell.

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 15 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 21 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].