Subnet Calculator
Type an IPv4 address in CIDR notation to get its network and broadcast addresses, subnet mask, wildcard mask and usable host range.
Result
Network address: 192.168.1.0/24
Two addresses of every block up to /30 are reserved, the network and broadcast addresses, so usable hosts are two fewer than the block size.
- Usable host range
- 192.168.1.1 to 192.168.1.254
- Usable hosts
- 254
- Broadcast address
- 192.168.1.255
- Subnet mask
- 255.255.255.0
- Wildcard mask
- 0.0.0.255
- Addresses in the block
- 256
- Subnet mask in binary
- 11111111.11111111.11111111.00000000
https://calcgallery.com/computing/subnet-calculator/
Results are the bit arithmetic that the named RFCs define, applied to what you enter. They do not check whether an address is reachable, assigned or reserved for a special purpose. Confirm network plans with whoever administers the network. Read the full disclaimer
How to use the Subnet Calculator
- Type the address and its prefix length the way a router shows it, for example 192.168.1.10/24. A dotted mask after the slash, such as 192.168.1.10/255.255.255.0, works too.
- Read the network address, the first and last usable host, and how many hosts the block holds.
- Use the wildcard mask where an access list or routing protocol asks for one; it is the subnet mask with every bit flipped.
How a prefix splits an address
An IPv4 address is a 32-bit number written as four octets. RFC 4632 writes a block as that address followed by a slash and the number of leading bits that name the network. The mask is simply those bits set to one and the rest to zero:
/20 mask 11111111.11111111.11110000.00000000 255.255.240.0wildcard 00000000.00000000.00001111.11111111 0.0.15.255network = address AND maskbroadcast = network OR wildcardaddresses = 2^(32 − prefix)
The network address keeps the address’s first 20 bits and clears the other 12. Setting those 12 bits instead gives the broadcast address. Everything between them is a host.
The edge cases
Most blocks lose two addresses, the network and the broadcast. A /31 does not: on a point-to-point link RFC 3021 makes both of its addresses hosts and gives it no broadcast address. A /32 is a single address, often used for a loopback or a host route. At the other end, /0 is the whole IPv4 space, 4,294,967,296 addresses.
Masks written in full
Older equipment writes the prefix as a dotted mask, and the page accepts that form. A mask is only a prefix if its ones are all on the left, so 255.255.240.0 is /20, while 255.0.255.0 is refused: RFC 950 allowed masks like that, but CIDR does not use them and no prefix length describes one. A wildcard mask such as 0.0.0.255 typed after the slash is not a prefix either; the page says so and gives the subnet mask with those bits flipped, 255.255.255.0 in that case.
With your numbers
- Address 11000000.10101000.00000001.00001010
- Mask /24 11111111.11111111.11111111.00000000
- Network = address AND mask = 11000000.10101000.00000001.00000000 = 192.168.1.0
- Broadcast = network OR wildcard = 11000000.10101000.00000001.11111111 = 192.168.1.255
- Addresses = 2^(32 − 24) = 256; usable hosts = 254
Quick reference
Two addresses of every block up to /30 are reserved, the network and broadcast addresses, so usable hosts are two fewer than the block size.
| Example | Network address |
|---|---|
| 192.168.1.10/24 | 192.168.1.0/24 |
| 10.20.30.40/8 | 10.0.0.0/8 |
| 172.16.5.4/20 | 172.16.0.0/20 |
| 203.0.113.77/27 | 203.0.113.64/27 |
| 100.64.0.1/10 | 100.64.0.0/10 |
| 198.51.100.6/31, point to point | 198.51.100.6/31 |
| 198.51.100.7/32, one address | 198.51.100.7/32 |
| 192.168.1.10 with mask 255.255.255.0 | 192.168.1.0/24 |
Common questions about the Subnet Calculator
- Why are there two fewer usable hosts than addresses?
- RFC 950 reserves the host part made of all zeros, which names the network itself, and the host part made of all ones, which is the broadcast address for every host on it. A /24 has 256 addresses and 254 hosts; a /30 has 4 addresses and 2 hosts.
- How can a /31 have two hosts?
- A link between exactly two routers needs no broadcast address, so RFC 3021 lets both addresses of a /31 be hosts. Without it, a point-to-point link needs a /30 and wastes half the addresses. Check that your equipment supports /31 before using one.
- What is the difference between a subnet mask and a wildcard mask?
- They are bitwise opposites. The subnet mask has ones where the address is network, 255.255.255.0 for a /24; the wildcard has ones where it is host, 0.0.0.255. Access lists and some routing protocols are written with wildcards.
- Why does the page reject 010.0.0.1?
- Some software reads an octet with a leading zero as octal, so 010 would mean 8, not 10. Rather than guess which you meant, the page asks for the octet without the zero.
- Does this say whether an address is private or public?
- No. Which ranges are private, shared or reserved is set by other RFCs and registries, and the page does not keep that list. It works out the arithmetic of whatever block you type.