About Subnet Calculator
Give it an address such as 10.0.5.20/19 and it tells you which network the address belongs to, which addresses in that network can be assigned, and what the mask looks like in each form you may be asked for. That answers the routine questions when planning a network, reading a firewall rule or setting up a cloud VPC.
It also shows the binary view, which is what makes subnets click for most people. Seeing where the network bits stop explains why /19 gives the odd-looking mask 255.255.224.0. A slider moves the prefix up and down, so you can watch the range change.
How it works
An IPv4 address is a 32-bit number. A prefix of /19 means the first 19 bits are the network and the other 13 number the hosts, so the block holds 2 to the power of 13, or 8,192 addresses. The network address is found by clearing the host bits, and the broadcast address by setting them all. Those two are reserved, leaving 8,190 usable hosts. The calculation uses whole-number arithmetic, not the signed 32-bit operators that can break on addresses above 128.0.0.0.
Two prefixes follow different rules. A /31 is a point-to-point link under RFC 3021, where both addresses work and there is no broadcast. A /32 is one address, often used for loopbacks and host routes. The page also names the kind of address, such as private under RFC 1918, shared carrier space under RFC 6598, documentation under RFC 5737 or link-local under RFC 3927, and it shows the old address class.
How to use Subnet Calculator
- Type in IP address with prefix or mask, as
10.0.5.20/19or10.0.5.20 255.255.224.0. - Move the Prefix length slider to try other sizes.
- Read the network, broadcast, host range and masks, and look at the In binary panel.
- Open Divide into smaller subnets and choose a New prefix length to list the pieces.
A real run
10.0.5.20/19Network address: 10.0.0.0
Broadcast address: 10.0.31.255
First usable host: 10.0.0.1
Last usable host: 10.0.31.254
Subnet mask: 255.255.224.0
Wildcard mask: 0.0.31.255
Usable hosts: 8,190
Total addresses: 8,192
Address class: A
Dividing into /21: That makes 4 subnets of 2,046 usable hosts each.The address 10.0.5.20 is a host in this block, and the network starts at 10.0.0.0. Networks of this size start every 32 in the third octet, since /19 leaves 5 host bits in that octet.
When it helps
- Finding the host range for a new LAN or VLAN before you assign addresses
- Planning cloud VPC subnets and working out how to split a block across zones
- Reading a firewall rule or an access list written with a wildcard mask
- Checking whether two addresses sit in the same subnet
- Practicing subnetting for a networking exam, with the binary view to check your work
Tips for a better result
- Paste the address as you find it. A mask works just as well as a prefix, and a mask with a gap in its 1 bits is rejected with a clear reason.
- Leave room to grow. Moving a planned subnet later is painful, and a
/24that looks generous today can run out quickly when devices multiply. - Cloud providers usually hold back a few addresses in every subnet for their own use, so you get fewer than the usable count here. Check your provider's documentation.
- To test whether an address is inside a network, enter it with that prefix and compare the network address shown with the one you expected.
Good to know
- IPv4 only. An IPv6 address is detected and you get a message saying so.
- Division makes equal-sized pieces. There is no variable-length plan, where one block is split into different sizes by need, so plan those yourself.
- The subnet list shows at most the first 256 rows, though the summary line gives the true total.
- It does not combine networks into a larger route, and it does not look anything up. It does not know who owns a public address or whether it is in use.
- Address classes are shown for reference only, as routing has not used them since CIDR replaced them in the 1990s.
Questions people ask
Why are there two fewer usable hosts than addresses?
The first address identifies the network and the last is the broadcast address, so neither is assigned to a device. The exceptions are /31 and /32, which have no such reserved addresses.
How do I convert a prefix to a subnet mask?
Write that many 1 bits followed by 0 bits, and read each group of 8 as a number. So /24 is 255.255.255.0 and /19 is 255.255.224.0. The slider here shows the mask as you move it.
What is a wildcard mask?
The mask with its bits flipped, so 255.255.224.0 becomes 0.0.31.255. Cisco access lists and some routing configurations use it, where a 1 bit means that position can be anything.
How many /26 subnets fit in a /24?
Four, since each extra prefix bit doubles the count. A real run on 192.168.1.0/24 gives 192.168.1.0, .64, .128 and .192, each with 62 usable hosts.
What to use next
- Number Base Converter: to convert an octet between decimal and binary
- Chmod Calculator: for permissions on the servers in that subnet
- User Agent Parser: to make sense of the clients in your server logs
Last reviewed . Read our editorial policy.