A firewall is software or hardware that helps prevent hackers and some types of malware from getting to your PC through a network or the Internet. It does this by checking the info that’s coming from the Internet or a network and then either blocking it or allowing it to pass through to your PC.
A firewall isn't the same thing as an antivirus or antimalware app. Firewalls help protect against worms and hackers, antivirus apps help protect against viruses, and antimalware apps help protect against malware. You need all three. You can use Windows Defender, the antivirus and antimalware software that's included with Windows 8, or you can use another antivirus and antimalware app.
You only need one firewall app on your PC (in addition to the firewall that's probably built into your network router). Having more than one firewall app on your PC can cause conflicts and problems.
Windows Firewall comes with Windows and is turned on by default.
Here’s a picture showing how a firewall works:
We recommend that you use these default firewall settings:
The firewall is on for all network types (Private, Public, or Domain).
The firewall is on for all network connections.
The firewall is blocking all inbound connections except those that you specifically allow.