Short answer: A subnet is a block of IP addresses. The number after the slash (the CIDR prefix) says how many of the 32 bits in an IPv4 address are fixed for the network; the rest are for hosts. A block has 2^(32 − prefix) addresses, and you can usually use two fewer, because the first is the network address and the last is the broadcast address. So a /24 has 256 addresses and 254 usable hosts.
Subnets turn up everywhere once you run a server: in firewall rules, IP allow lists, VPS networking and the "IP block" your provider gives you. You don't need to do binary in your head, but knowing what the numbers mean saves a lot of guessing. Our free subnet calculator does the sums for any IPv4 or IPv6 range.
How an IPv4 address is built
An IPv4 address like 192.168.1.10 is 32 bits, written as four numbers from 0 to 255 (each one is 8 bits, called an octet). A subnet splits those 32 bits in two:
- Network bits at the start, the same for every address in the block.
- Host bits at the end, different for each device.
CIDR notation writes the split after a slash. 192.168.1.0/24 means the first 24 bits are the network (192.168.1) and the last 8 bits are for hosts (0 to 255).
Subnet masks
A subnet mask says the same thing in the older dotted form: network bits are 1, host bits are 0. A /24 is 24 ones followed by 8 zeros, written 255.255.255.0.
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point links) |
| /32 | 255.255.255.255 | 1 | 1 (a single address) |
Each step up in the prefix halves the block. A /31 is a special case used for links between two routers, where both addresses are used (RFC 3021). A /32 means exactly one address, which is how firewalls and allow lists name a single server.
Working out a subnet by hand
Take 192.168.1.70/26:
- A /26 leaves 6 host bits, so each block is 2^6 = 64 addresses.
- Blocks start at multiples of 64 in the last octet: 0, 64, 128 and 192.
- 70 falls in the block that starts at 64.
- So the network address is 192.168.1.64, usable hosts run from .65 to .126, and the broadcast address is 192.168.1.127.
The quick rule: block size = 256 minus the last non-255 number of the mask. For 255.255.255.192, that is 256 − 192 = 64.
Where subnets matter for websites and servers
- Firewall rules. "Allow SSH from 203.0.113.0/24" lets in any address from 203.0.113.0 to 203.0.113.255. Getting the prefix wrong can let in far more of the internet than you meant, or lock you out. See our UFW firewall guide.
- Allow lists. cPanel, databases and admin panels often accept a CIDR range, for example your office network.
- VPS and dedicated servers. Providers usually route a single /32 or a small block to your server, and list the gateway and mask you need. Our guide to first steps on a new VPS covers the setup.
- Private networks. Home and office networks use private ranges such as 192.168.0.0/16. See public vs private IP addresses.
IPv6 subnets
IPv6 addresses are 128 bits, so the numbers are much larger and nobody counts hosts one by one. A single network (a LAN or a server's interface) is normally a /64, which is more addresses than the whole IPv4 internet. Providers typically give a site a /48 or /56 to split into /64s, and a single address is a /128. Read more in IPv4 vs IPv6.
Frequently asked questions
How many usable IP addresses are in a /24?
- A /24 has 256 addresses; the first (.0) is the network address and the last (.255) is the broadcast address, so hosts use .1 to .254.
What is the difference between a subnet mask and CIDR?
They describe the same thing. CIDR writes the number of network bits after a slash (/24); a subnet mask writes them as four numbers (255.255.255.0). Most modern tools accept CIDR.
Why does a /32 mean one address?
All 32 bits are network bits, so there are no host bits left and the block is a single address. Firewalls use /32 to name one exact IP.
Can I calculate a subnet without doing binary?
Yes. Use the block-size rule (256 minus the last non-255 number of the mask) or our free subnet calculator, which shows the network, broadcast, host range and mask for any IPv4 or IPv6 subnet.



