What Is a Subnet? Subnet Masks & CIDR Explained
Published November 2026 — Current as of November 2026 — Estimated read time: 8 minutes
A subnet (short for subnetwork) is a logical division of a larger IP network. It splits one big pool of addresses into smaller, self-contained ranges so that traffic within a group stays local and traffic between groups is deliberately controlled. Understanding what a subnet is, how subnet masks work, and how to calculate subnets is foundational for anyone who configures firewalls, routers, or subnet calculator work in network design.
This guide covers the plain-language definition of a subnet, why subnets matter for security, IPv4 addressing basics, subnet masks explained, CIDR notation explained, and a step-by-step way to calculate how many usable hosts any network gives you.
1. What Is a Subnet?
Think of a network as one large street with every building numbered in a single sequence. A subnet is like dividing that street into named blocks, each with its own smaller numbering scheme. Every device still has a unique address, but the blocks group related devices together — phones in one block, servers in another, guest Wi-Fi in a third.
Networks are divided into subnets for three practical reasons. First, efficiency: routing traffic inside a subnet is faster and simpler than routing it across the whole network, because local traffic never has to leave the subnet. Second, organization: grouping devices by function makes them easier to manage, monitor, and address. Third, and most important for security, control: subnets give you boundaries where you can filter who talks to whom.
2. Why Subnets Matter for Security
For a security team, subnets are the mechanism behind network segmentation — the practice of dividing a network into separate security zones with enforced rules between them. Rather than trusting every device on the same flat network, segmentation treats each subnet as its own trust domain.
The security payoffs are direct:
- Blast-radius reduction. If an attacker compromises one device, segmentation keeps them from freely reaching every other system. A breach confined to one subnet is far less damaging than a breach with a straight path to everything.
- Controlled east-west traffic. Firewalls and access lists sit at the boundaries between subnets, so you can explicitly allow the traffic you expect and drop everything else.
- IoT isolation. Smart cameras, thermostats, and sensors rarely need to reach your file servers. Putting Internet of Things devices on their own subnet keeps them functional while preventing them from being a beachhead into your business network.
Segmentation is a core control in standards like NIST CSF and is one of the most effective things a small business can do without buying new hardware — it is mostly a matter of planning your address space and configuring a capable router.
3. IP Addressing Basics: IPv4 Octets
To understand subnets, you start with how an IPv4 address is written. An IPv4 address is 32 bits long, shown as four groups of eight bits separated by dots — called octets. Each octet is a number from 0 to 255, so a typical address looks like 192.168.1.10.
Every IPv4 address has two logical parts: the network portion, which identifies the subnet the address belongs to, and the host portion, which identifies the specific device within that subnet. The subnet mask is what tells you where the line falls between these two parts.
4. Subnet Masks Explained
A subnet mask is a 32-bit number that marks which bits of an IP address belong to the network and which belong to the host. In binary, the mask is a run of ones followed by zeros. The ones cover the network portion; the zeros cover the host portion.
For example, the mask 255.255.255.0 in binary is 24 ones followed by 8 zeros. That means the first 24 bits (the first three octets) are the network, and the last 8 bits identify the host. Put a mask on an address and you can instantly tell which subnet it belongs to by masking off the host bits.
Common subnet masks you will encounter:
255.255.255.0— a standard small office network255.255.255.128— half a /24, common for splitting a small network in two255.255.0.0— a larger network spanning two octets
5. CIDR Notation Explained
Writing out full masks all the time is tedious, so networks are usually described with CIDR notation (Classless Inter-Domain Routing). CIDR appends a slash and a number to an address, where the number is the count of ones in the subnet mask — the prefix length. A /24 is the CIDR shorthand for the mask 255.255.255.0, meaning 24 bits are reserved for the network and 8 for hosts.
Here is the correspondence between the masks and CIDR notation you will use most often:
| CIDR | Subnet Mask | Total Addresses | Usable Hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /27 | 255.255.255.224 | 32 | 30 |
| /30 | 255.255.255.252 | 4 | 2 |
6. How to Calculate Subnets
The single formula you need is:
usable hosts = 2^(32 - prefix) - 2
The 2^(32 − prefix) term gives the total number of addresses in the subnet. You subtract 2 because the very first address in every network is reserved as the network address, and the very last is reserved as the broadcast address — neither can be assigned to a device.
Worked example: a /24
A /24 has a prefix of 24, so the exponent is 32 − 24 = 8, and 2^8 equals 256. Subtract the 2 reserved addresses and you get 254 usable hosts. That matches the familiar 192.168.1.x style network: 256 total addresses, with the network and broadcast addresses set aside.
Worked example: a /27
A /27 has a prefix of 27, so the exponent is 32 − 27 = 5, and 2^5 equals 32. Subtract 2 and you get 30 usable hosts. A /27 is a classic size for a small office or a guest network — big enough for a modest set of devices but small enough to keep the blast radius tight.
The pattern scales: the larger the prefix, the fewer the addresses. If you are planning an address space, work out how many hosts each subnet needs, pick the smallest prefix that fits, and always leave headroom for growth.
Use Our Free Subnet Calculator
Enter any IP address and prefix and get the subnet mask, total addresses, and usable hosts instantly — no math required.
Calculate Subnets Now →7. Private Address Ranges
Certain IPv4 ranges are reserved for private use and are not routable on the public internet. Defined in RFC 1918, these are freely usable inside any organization without registration:
10.0.0.0/8— one huge range, from 10.0.0.0 to 10.255.255.255172.16.0.0/12— from 172.16.0.0 to 172.31.255.255192.168.0.0/16— the familiar home and small-office range
Because these ranges are non-routable, devices inside them reach the internet only through network address translation (NAT) at the edge router. They are exactly the space you want for internal segmentation — you can carve them into as many subnets as your design needs. Note that this is a separate idea from a subdomain, which is a label in a DNS name (like blog.example.com), not a subdivision of an IP network.
8. Common SMB Subnetting Use Cases
For small and medium businesses, a little subnetting goes a long way. Three patterns cover most needs:
- Guest Wi-Fi separation. Put guest traffic on its own subnet with no route (or only a limited one) to your internal network. Visitors get internet access, but they cannot reach your file servers. Most small-business routers support this with a "guest network" toggle.
- A DMZ. Place public-facing services — a web server, a mail relay, a VPN endpoint — on their own subnet so that if one is compromised, the attacker is not already inside your trusted network.
- VLAN-style segmentation. With a VLAN-capable switch or router, assign different devices to different subnets (staff, IoT, cameras, phones) even though they share physical cabling. This gives you most of the security of separate physical networks without the wiring.
The returns are practical: an IoT device on its own subnet cannot read your accounting files during a breach, and a compromised guest device cannot pivot to your servers.
9. Calculate Subnets Now
Subnetting looks intimidating until you reduce it to the one formula above. Once you know your prefix, the usable-host count is seconds of arithmetic away — and a tool makes it trivial.
Use Our Free Subnet Calculator
Turn any IP and prefix into the subnet mask, wildcard, private range, and usable-host count instantly. Free, no signup.
Use Our Free Subnet Calculator →Related Tools
Domain Security Scorecard
Score the DNS, email, and TLS posture of any domain in one pass.
DNS Lookup
Resolve A, AAAA, CNAME, MX, TXT, NS, and more for any hostname.
Subdomain Finder
Enumerate subdomains to map your attack surface.
SSL Grader
Grade the TLS configuration of any site against current standards.