Firewall explained in plain terms means a guard that sits between a network and the outside world, checking traffic as it passes and blocking anything that should not get through. The central question is how a network can stay connected to the internet while keeping strangers out, and the short answer is that the firewall inspects every connection and allows only the traffic its rules permit.
Think of a security desk at the entrance to a building. Visitors state who they are and where they are going, the guard checks the list, and only those with a reason to enter are waved through.
A firewall works in the same way. It examines network traffic, compares it against a set of rules, and decides whether each piece may pass, in either direction.
Key takeaways
- A firewall is a guard that checks network traffic against a set of rules.
- It blocks unwanted connections while letting trusted traffic through.
- Rules decide which addresses, ports, and services may connect.
- Firewalls protect both individual devices and whole networks.
- Rules must be reviewed, because old ones can leave gaps.
What a firewall is
A firewall is a system, built from software or hardware, that monitors traffic flowing into and out of a network and decides what may pass. It sits at a boundary, such as between a home network and the internet, or between the public internet and a company servers, and every connection must cross it.
The decisions are made by rules. A rule might allow web traffic to reach a web server, allow staff to reach a mail server, and block everything else. The firewall applies these rules to each connection, and traffic that matches no allowed rule is refused.
Firewalls do not read the meaning of your messages or decide whether a website is trustworthy in the human sense. They work with the facts of the connection: where it comes from, where it is going, which service it asks for, and whether it belongs to a conversation that is already under way.
Our guide to API security explains how interfaces are protected from misuse, and a firewall is a neighbouring layer of the same defence. The firewall controls which connections reach a service at all, while API security controls what those connections may do once they arrive.
How a firewall inspects traffic
The simplest firewalls inspect the envelope of each connection. They look at the source address, the destination address, and the port number, which identifies the service being asked for. A request to the web port of a web server looks different from a request to a database port, and the firewall can allow one and refuse the other.
More capable firewalls keep track of the state of each connection. They remember which conversations are already under way, so that replies to a request you sent are allowed through while unsolicited connections from outside are not. This stateful inspection is the reason your computer can browse the web while refusing strangers who try to connect to it uninvited.
The most advanced firewalls look deeper, into the content of the traffic itself. They can recognise the application behind a connection, spot patterns that suggest an attack, and block traffic that looks harmful even when it uses an allowed port. This deeper inspection costs more effort, so it is used where the risk justifies it.
In every case the principle is the same: inspect, compare against the rules, and decide. Traffic that passes is forwarded to its destination, and traffic that fails is dropped, often without any reply, so the sender learns nothing about what lies behind the wall.
Types of firewall
A network firewall is a device or service that guards a whole network. It sits at the boundary where the network meets the internet, and it protects every device behind it at once. Home routers include a basic version of this, while companies use larger appliances or cloud services that do the same job at scale.
A host firewall runs on a single device, such as a laptop or a server, and guards that device alone. It decides which applications on the device may accept connections and which may reach out, which matters when a device travels between networks or when a network firewall cannot be trusted to cover every case.
A web application firewall specialises in protecting websites and web services. It understands web traffic in detail and can block attacks aimed at the application itself, such as attempts to inject harmful instructions into a form or to trick the application into revealing data it should not.
Cloud firewalls are delivered as a service rather than a box in a room. They guard resources that live in the cloud, where there may be no single boundary to place a device on, and they apply the same rules wherever the resources happen to run. Our guide to zero-knowledge proofs explains a different way of proving things without revealing secrets, and it pairs naturally with firewalls: one guards the door, while the other proves identity without handing over the secret itself.

Comparing firewall types
| Aspect | Network firewall | Host firewall | Web application firewall |
|---|---|---|---|
| Protects | A whole network | One device | Websites and web services |
| Placed at | Network boundary | On the device | In front of the application |
| Sees | Addresses and ports | Applications on the device | Web requests in detail |
| Best for | Perimeter defence | Individual machines | Attacks on web applications |
What firewall rules look like
A firewall rule is a simple instruction: allow or deny a particular kind of traffic. A typical set might allow web traffic to the web servers, allow secure shell access only from the office network, allow staff to reach the internet, and deny everything else. The order of the rules matters, because the first rule that matches a connection decides its fate.
The safest starting point is to deny everything and then add rules for what is needed. This default-deny approach means that a forgotten service stays closed rather than accidentally open, and every opening exists because someone chose to allow it.
Rules need names, owners, and reasons written down. A rule that allows a particular address may have made sense for a project that ended months ago, and without a note explaining why it exists, nobody will dare to remove it. Over time, a firewall accumulates such rules, and the pile becomes a risk in itself.
Good practice is to review the rules regularly, remove those that are no longer needed, and test that the removals do not break anything. A firewall whose rules are never reviewed slowly drifts from a careful defence into a collection of openings nobody remembers approving.
Where firewalls are used
Firewalls are used in homes, where the router quietly blocks unsolicited connections from the internet while letting the household browse, stream, and play. Most people never think about this firewall, which is a sign that it is doing its job well.
Companies use firewalls at every boundary: between the internet and their offices, between their offices and their data centres, and between different parts of their own networks. A common design divides a company network into zones, with a firewall between each zone, so that a breach in one area cannot move freely into the next.
Cloud services use firewalls to guard virtual networks, where the boundary is logical rather than physical. Each service can have its own rules, so a database accepts connections only from the application servers that need it, and nothing else can reach it at all.
Individual devices carry host firewalls as well, which protect a laptop when it joins an unfamiliar network. A café network cannot be trusted the way an office network can, and the host firewall is what keeps the laptop safe there.
Challenges and limits of firewalls
A firewall cannot protect against everything. It controls connections, not the content of trusted ones, so a harmful file downloaded through an allowed connection will still reach the user. That is why firewalls sit alongside other protections, such as antivirus software and careful handling of attachments.
A firewall is also only as good as its rules. A rule that allows too much, such as opening a service to the whole internet when only one office needs it, defeats the purpose. Writing rules that are narrow and specific takes thought, and it is tempting to open things widely to make a problem go away.
Encrypted traffic creates a further challenge. A firewall that cannot look inside an encrypted connection can only judge it by its envelope, which limits what it can spot. Some firewalls inspect encrypted traffic with permission, but that raises its own questions about privacy and trust.
Finally, a firewall that is misconfigured can block legitimate work. A new service that cannot be reached, a colleague who cannot connect, or a backup that silently fails can all be the result of a rule that was too strict. The balance between safety and usability is the daily work of whoever tends the firewall.
Firewall checklist
- Start from deny everything, then allow only what is needed.
- Keep rules narrow: specific addresses and ports, not the whole internet.
- Use a host firewall on devices that travel between networks.
- Divide a company network into zones with firewalls between them.
- Write down the reason and owner for every rule.
- Review the rules regularly and remove the ones no longer needed.
- Test changes before applying them, so work is not blocked.
- Log blocked traffic and check the logs for patterns.
- Remember a firewall is one layer, not the whole defence.
Frequently asked questions
What is a firewall?
A firewall is a system that sits at the boundary of a network and checks traffic passing through it against a set of rules. It allows the traffic that the rules permit and blocks the rest, keeping unwanted connections out while letting trusted traffic through.
How is a network firewall different from a host firewall?
A network firewall guards a whole network from its boundary and protects every device behind it at once. A host firewall runs on a single device and guards that device alone, which matters when the device moves between networks or the network firewall cannot cover every case.
What is a web application firewall?
A web application firewall specialises in protecting websites and web services. It understands web traffic in detail and can block attacks aimed at the application itself, such as attempts to inject harmful instructions or to trick the application into revealing data.
Do I still need a firewall if I have antivirus software?
Yes. A firewall controls which connections may reach your device or network, while antivirus software looks for harmful files and programs that are already there. They guard different things, and each leaves gaps the other covers.
Can a firewall block legitimate traffic?
Yes. A rule that is too strict can block a service, a colleague, or a backup that should be allowed. That is why rules should be tested before they are applied and reviewed regularly, so that safety does not quietly turn into disruption.
Is a firewall enough to keep a network safe?
No. A firewall is one layer of defence, and it works best alongside other protections such as encryption, strong authentication, careful handling of files, and keeping software up to date. No single tool can protect a network on its own.
The bottom line
Firewall explained in one line is this: a guard at the boundary of a network that checks every connection against its rules and lets through only what is allowed.
It is a simple idea with lasting value. Networks must stay connected to be useful, and a firewall is what makes that connection safe, by deciding, connection by connection, who may enter and who must stay outside.







