CIDR to Subnet Mask Table
The slash number, like /24, is CIDR notation. It says how many bits of the address are the network part. The rest are for hosts. Here's the full translation to the dotted-decimal mask you type into settings.
| CIDR | Subnet mask | Usable hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /23 | 255.255.254.0 | 510 |
| /22 | 255.255.252.0 | 1022 |
| /16 | 255.255.0.0 | 65534 |
| /8 | 255.0.0.0 | 16777214 |
In regards to the ‘usable hosts’ column, a /24 subnet has a total of 256 addresses, but 2 are reserved, one for the network address and one for the broadcast address, thereby making a total of 254 available for actual devices. This is the case for all subnets.
How to Read a Subnet Mask
Essentially the subnet mask tells you which part of an IP address is the network and which part is the host.
Like a street and a house number, the subnet mask defines the boundary between the network and the host. Where there is a 1 in the mask, it is part of the network. Where there is a 0, it is part of the host.
Take 255.255.255.0, a /24. In binary that's twenty-four 1s followed by eight 0s. So the first three numbers of the address are the network, and the last number is the host. That's why a /24 gives you hosts from .1 to .254 on the same network. Change the mask to /25 and you split that block in half.
The higher the CIDR number, the smaller the network. A /30 has just two usable hosts, perfect for a point-to-point link between two routers. A /16 holds over 65,000, big enough for a large company.
Hosts Per Subnet: The Formula
If you'd rather calculate than look up, the math is simple. The number of host bits is 32 minus the CIDR number. The total addresses are 2 raised to that power. Subtract 2 for the usable count.
So for a /26: host bits are 32 minus 26, which is 6. Two to the sixth is 64 total addresses. Minus the network and broadcast, that's 62 usable hosts. The table above just saves you from doing this each time.
The “minus 2” exception is for a /31, which in modern networks allows for a point to point connection with two hosts. In most other cases the “minus 2” rule applies. For most common subnets this is the case.
Private IP Ranges
Not all IP addresses are accessible from the internet. Three IP ranges are set aside for use in private networks and are typically found within your home or office. Your devices use these internally and are translated to your public IP address by a technology called NAT.
| Range | CIDR | Common use |
|---|---|---|
| 10.0.0.0 to 10.255.255.255 | 10.0.0.0/8 | Large networks |
| 172.16.0.0 to 172.31.255.255 | 172.16.0.0/12 | Medium networks |
| 192.168.0.0 to 192.168.255.255 | 192.168.0.0/16 | Home and small office |
You’ve probably seen 192.168.1.1 a million times. It is found on many home routers and is used as the default gateway. It is found on many networks, including your own, and is totally fine since these addresses never leave their network.
A Real-World Example
Let’s say you’ve 50 computers on your office network and need to divide them into subnets. Which subnet mask would you use?
A /26 gives 62 usable hosts. That covers your 50 machines with a dozen to spare, and it's tighter than a /24, which would waste 200 addresses. So you'd configure the subnet as something like 192.168.1.0/26, with a mask of 255.255.255.192. Hosts run from 192.168.1.1 to 192.168.1.62, the network address is 192.168.1.0, and the broadcast is 192.168.1.63.
Need a second department of similar size? The next /26 block starts at 192.168.1.64. Subnetting lets you slice one network into clean, non-overlapping pieces, each sized to its job.
How to Check and Calculate Subnets
Manually figuring this out is easy with small numbers, but a subnet calculator is helpful, and gives the correct answer, with larger or more obscure values. These calculators typically take three inputs: a given IP, a CIDR value, and a mask length. They give the mask, host range, network address, and broadcast address.
For the official definitions, the [IETF's RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) is the document that defines the private address ranges, and [Cloudflare's learning center](https://www.cloudflare.com/learning/network-layer/what-is-a-subnet/) explains subnets in plain language. If you work with IP addresses often, the free [Denwix tools](https://denwix.com/) can help you inspect and convert network values.
The Bottom Line
Learning subnet masks is easier with a cheat sheet. The mask separates an IP address into network and host portions. The smaller the CIDR is, the larger the network, and therefore the more subnets. Private IP address ranges and CIDRs should be memorized for subnetting. The CIDR table, private address ranges, and a little guess work are all you need to figure out subnets.
Questions and Answers
What is a subnet mask?
A subnet mask denotes which part of an IP address is the network and which part is the host. An example of such a mask would be 255.255.255.0 which is equivalent to a /24.
What is CIDR notation?
CIDR notation is the slash number after an IP, like /24. It states how many bits of the address belong to the network. The rest of the bits are available for hosts.
How many hosts are in a /24?
A /24 has 256 total addresses, of which 2 are used for the network and broadcast addresses respectively. Thus, only 254 addresses are available for host devices.
How do I convert CIDR to a subnet mask?
Counting the number of 1's in the mask yields the equivalent of the IP address in dotted decimal format. Thus, a /24 mask would be 255.255.255.0.
How many usable hosts are in a /26?
A /26 has 64 total addresses and 62 usable hosts. The math is 2 to the power of 6 host bits, minus 2 for the network and broadcast addresses.
What does /30 mean?
A /30 subnet has 4 total addresses and 2 usable hosts. It’s typically used for point to point connections between two routers.
Why do I subtract 2 from the host count?
Each subnet has to reserve two addresses. The first is the network address and the last is the broadcast address. Neither of these are assignable to a device and therefore don’t count as usable addresses.
What are the private IP ranges?
They are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These addresses are reserved for private networks and are not routable on the public internet.
Why is 192.168.1.1 so common?
It falls in the 192.168.0.0/16 private range and is the default gateway address for many home routers. It repeats on millions of networks because private addresses never leave their own network.
What is the difference between a network and a host address?
The network address identifies the subnet. Between the network address and the broadcast address are the host addresses which are further broken down to assign to devices on the subnet.
What is a broadcast address?
It's the last address in a subnet, used to send a message to every device on that network at once. It can't be assigned to a single device.
How do I calculate the number of subnets?
Decide how many host bits you need, then the remaining borrowed bits give you subnets. Each borrowed bit doubles the number of subnets while halving the hosts per subnet.
What is a /32 subnet?
A /32 is used to indicate a single IP address with no capacity to be further subdivided. It is used to define a host route or a loopback address.
What does 255.255.255.0 mean?
It's the subnet mask for a /24 network. The three 255s mark the network portion, and the final 0 marks the host portion, giving 254 usable addresses.
How many IPs are in a /16?
A /16 has 65,536 addresses with 65,534 potential host addresses. Used to provide a large address space to a single large organization.
What is NAT?
Network Address Translation allows a single public IP address to be used by multiple private IP addresses. Your household router employs NAT to allow multiple household devices to communicate with the internet using the same single public IP address.
How do I find my subnet mask?
On Windows, run ipconfig in the command prompt. On Mac or Linux, check network settings or run ifconfig. The output shows the subnet mask for each connection.
What is the difference between /24 and /25?
A /24 gives you one network with 254 hosts. A /25 divides this into two networks with each having 126 hosts. The larger the number, the smaller the subnet.
Can two subnets overlap?
Not at all. Overlapping subnets create issues with routing and connectivity. Make sure to plan subnets so that each occupies a unique, non-overlapping range of addresses.
Do I need to memorize the subnet table?
Not really. Engineers generally use a subnet calculator or keep a cheat sheet to look up values. It is completely acceptable to look up values you don’t remember.
What is a /28 subnet?
A /28 gives you a network with 16 addresses and 14 usable hosts with a mask of 255.255.255.240. This makes a small block of addresses good for 12-13 devices.
How do I calculate the broadcast address?
The broadcast is the last address in the subnet, where all host bits are set to 1. For 192.168.1.0/26, the broadcast is 192.168.1.63, just before the next block begins.
What is the network address?
It's the first address in a subnet, where all host bits are 0. It identifies the subnet itself and can't be assigned to a device, which is why you lose it from the usable count.
How many subnets can a /24 be split into?
Again, this depends on the new prefix. A /24 for example can be split into two /25s, four /26s, eight /27s and so on. Each additional borrowed bit increases the number of subnets and decreases the number of hosts.
What does a /29 give me?
A /29 has 8 total addresses and 6 usable hosts, with a mask of 255.255.255.248. It suits a very small group of devices or a handful of servers.
Is 172.16.0.0 a private range?
Yes. The 172.16.0.0/12 block, covering 172.16.0.0 through 172.31.255.255, is one of the three private ranges reserved for internal networks.
How do I find the usable host range?
The usable hosts run from one above the network address to one below the broadcast. For 192.168.1.0/26, that's 192.168.1.1 through 192.168.1.62.
What is a wildcard mask?
A wildcard mask is the inverse of a subnet mask and is used in access control lists on some routers. Where there is a 1 in the subnet mask, there is a 0 in the wildcard mask and vice versa.
What does a subnet mask of 255.255.255.128 mean?
This is a /25 network with 128 addresses of which 126 are available for host addresses. It subdivides a /24 network into two equal subnetworks.
Can a subnet have zero usable hosts?
A /31 provides two addresses and therefore two host addresses for a point to point link. A /32 provides a single address for a single host.
How do I pick the right subnet size?
Decide on the number of devices required plus some headroom and pick the smallest block that encompasses that number. 50 devices can comfortably be accommodated with a /26.