Subnetting Made Simple: IP Addresses and Masks in Binary
Understand IPv4 addresses, subnet masks and CIDR by looking at the bits. Includes worked examples and a cheat sheet.
An IP Address Is Just 32 Bits
192.168.1.10 looks like four numbers, but a computer sees 32 bits:
11000000.10101000.00000001.00001010
Each of the four octets is 8 bits, so each ranges from 0 to 255. See it for any address with the [IP to Binary Converter](/tools/ip-to-binary).
The Subnet Mask Splits Network from Host
A mask such as 255.255.255.0 is a run of 1s followed by 0s:
11111111.11111111.11111111.00000000
Bits under the 1s identify the network. Bits under the 0s identify a device on that network. CIDR notation simply counts the 1s, so 255.255.255.0 is /24.
Worked Example: 192.168.1.10/26
Quick Reference
| CIDR | 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 |
| /30 | 255.255.255.252 | 2 |
The full table from /0 to /32 is in our [subnet mask cheat sheet](/tools/ip-to-binary/subnet-mask-table).
Other Ways to Write an IP
Databases often store IPv4 addresses as a single number because range checks become simple comparisons. 192.168.1.10 is 3232235786 as an integer. Convert with [IP to Decimal](/tools/ip-to-decimal) and back with [Decimal to IP](/tools/decimal-to-ip). Packet captures sometimes show hex instead: use [Hex to IP](/tools/hex-to-ip).
Summary
Subnetting gets easy once you look at the bits. Count the 1s for the prefix, count the 0s for the host space, and the network and broadcast addresses follow.
Try our free tools
Put these tips into practice with 45+ free online tools - no signup, no login.
Browse Free Tools