How to Set Up a Computer Firewall on Windows and Mac
You have probably clicked "Allow" on a firewall pop up without reading it, or found out months later that the firewall on your Mac was never switched on at all.

You have probably clicked "Allow" on a firewall pop up without reading it, or found out months later that the firewall on your Mac was never switched on at all. Neither is unusual, and both leave a laptop more exposed than it needs to be, especially on hotel, cafe or shared office networks.
A computer firewall decides which network connections are allowed in and out of your machine. The built in firewalls in Windows and macOS are good enough for nearly everyone, but only if they are turned on and configured sensibly. This guide covers what a firewall actually does, how to set it up on each system in about 15 minutes, and which settings matter most.
What a computer firewall does and does not do
Think of a firewall as a door policy. Every program that wants to receive connections from the network, or in some setups make them, has to pass a rule. If there is no rule allowing it, the connection is dropped.
On a home or small office machine, the most important job is blocking unsolicited incoming connections. Many attacks on unpatched systems start with something on the network reaching out to a listening service, such as file sharing or remote desktop. A firewall closes those doors unless you open them on purpose.
What a firewall does not do is stop you from downloading malware, clicking a phishing link or typing your password into a fake site. Those threats travel over connections you started yourself, which the firewall normally allows. It is one layer, not the whole wall. That is why it belongs alongside antivirus, updates and DNS filtering at home rather than replacing them.
How to set up the computer firewall on Windows 11
Windows Defender Firewall is on by default on new installs, but it is often switched off by older antivirus suites, IT scripts or troubleshooting sessions that were never undone. Check it now.
- Open Start, type Windows Security and open it.
- Select Firewall and network protection.
- You will see three profiles: Domain network, Private network and Public network. Each should say Firewall is on. If any say off, click it and switch Microsoft Defender Firewall on.
- Click the active profile, usually Private or Public, and make sure Blocks all incoming connections, including those in the list of allowed apps is ticked on the Public profile. Leave it unticked on Private if you share printers or files at home.
- Back on the main page, click Allow an app through firewall. Scroll the list and untick anything you no longer use, especially old games, remote access tools and file sharing apps.
Then confirm your current network is set to the right profile. Go to Settings, Network and internet, Wi-Fi, then click the network name. Choose Public network for anywhere that is not your own home or office. Public mode hides your PC from other devices and applies the stricter rules.
While you are in Windows Security, it is worth checking the other Microsoft Defender settings worth turning on, since the firewall works best alongside them.
How to set up the firewall on a Mac
On macOS, the firewall is turned off by default on many machines. Apple's reasoning is that a fresh Mac has no listening services enabled, but that changes as soon as you turn on file sharing, screen sharing or install certain apps.
- Open the Apple menu, then System Settings.
- Click Network in the sidebar, then Firewall.
- Switch the firewall on. You may need your admin password.
- Click Options. Turn on Enable stealth mode, which stops your Mac from replying to probing requests such as pings from other devices on the network.
- Review the list of apps. Remove any you do not recognise or no longer use with the minus button.
- For extra protection on public networks, enable Block all incoming connections. Turn it off again at home if AirDrop or screen sharing stops working.
Also visit System Settings, General, Sharing, and switch off anything you do not use: file sharing, remote login, remote management and media sharing. Every service you turn off is one less door for the firewall to guard.
Handling firewall pop ups without guessing
Both systems ask permission when an app wants to accept incoming connections for the first time. Most people click Allow just to make the box go away. A better habit takes five seconds:
- Did you just open this app? If a game or video call app asks right after you launched it, allowing it is usually fine.
- Do you recognise the name? If the pop up names something unfamiliar, or appears when you were not doing anything, deny it and look up the file name later.
- Which network are you on? On Windows, tick only Private networks unless you truly need the app on public Wi-Fi.
Denying by mistake is easy to fix in the allowed apps list. Allowing malware by mistake is much harder to undo.
Do you need a third party firewall?
For most people, the honest answer is no. A lot of security advice still tells home users to install a paid firewall suite. That made sense in the Windows XP era, when the built in firewall was basic and off by default. Today Microsoft Defender Firewall and the macOS firewall are solid, free and updated with the operating system.
Third party firewalls can add value in one specific area: outbound control. Tools like Little Snitch or LuLu on Mac, and simpleWall or GlassWire on Windows, show which apps are connecting out and let you block them. That is useful if you want to stop an app phoning home or spot unexpected traffic. But they also generate many prompts, and people who get tired of them often click Allow on everything, which defeats the purpose. If you are not willing to read the prompts for the first two weeks, stick with the built in firewall.
For a wider list of free protections to set up before paying for anything, see the free security tools worth setting up first.
A quick monthly firewall check
Once a month, or after installing any large program, spend two minutes on these checks:
- Confirm the firewall still shows as on for every profile.
- Scan the allowed apps list for anything new you did not expect.
- Check your Wi-Fi network is marked Public when travelling.
- Make sure the operating system is fully updated, since firewall fixes ship with system updates.
Frequently asked questions
Should I turn on the firewall on my Mac?
Yes, especially if you use public Wi-Fi or have turned on any sharing features. It costs nothing in performance for normal use. Turn on stealth mode as well for extra quiet on unfamiliar networks.
Is Windows Defender Firewall enough for home use?
For nearly all home users, yes. It blocks unsolicited incoming connections, applies stricter rules on public networks and updates with Windows. Pair it with regular updates, Microsoft Defender antivirus and a password manager for solid everyday protection.
Can a firewall stop hackers completely?
No. A firewall blocks unwanted network connections but cannot stop threats you let in yourself, such as phishing links or infected downloads. It is one important layer among several, including updates, strong passwords and two factor authentication.
More in Tools and Software
Tools and Software
Use a Mesh VPN Instead of Port Forwarding at Home
A reader sent me a router screenshot last spring because something felt wrong.
Tools and Software
How to Check Your Home Network for Open Ports Safely
A reader sent me a screenshot last year of a scan showing port 32400 open on his home connection. He did not recognise it.
Tools and Software
How to Use Windows Sandbox to Open Suspicious Files
An invoice arrives as a ZIP from a supplier you have dealt with before, but the wording is slightly off.