IP Subnet Calculator
Enter an IP address with a prefix or mask and get the network address, broadcast address, usable host range, wildcard mask and the binary view – for IPv4 and IPv6.
How a subnet is calculated
An IPv4 address has 32 bits. The prefix – the number after the slash – says how many of them belong to the network; the rest identify the host. In 192.168.1.10/24 the first 24 bits (192.168.1) are the network and the last 8 bits (10) the host.
- Network address – all host bits 0: 192.168.1.0
- Broadcast address – all host bits 1: 192.168.1.255
- Usable hosts – everything in between: 192.168.1.1 to 192.168.1.254, that is 2⁸ − 2 = 254 addresses
The calculator does this with a bitwise AND between the address and the mask, and shows the bits in two colours so you can see where the network part ends.
Worked example: 10.20.30.40/20
A /20 mask is 255.255.240.0. The third octet, 30, is 00011110 in binary; the mask keeps its first four bits, 0001, which gives 16. So the network is 10.20.16.0, the broadcast 10.20.31.255 and there are 2¹² − 2 = 4,094 usable hosts.
Special cases
- /31 – point-to-point links between two routers (RFC 3021): both addresses are usable and there is no broadcast.
- /32 – a single host, used for loopbacks and host routes.
- Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are not routed on the internet. 100.64.0.0/10 is shared address space for carrier-grade NAT.
Address classes
Classes A (1–126), B (128–191) and C (192–223) come from the time before CIDR, when the first octet fixed the mask. They are still taught and shown here, but routing today uses the prefix, not the class.
IPv6
Switch to IPv6 to get the compressed and expanded form of an address, the network and the first and last address of the range. A /64 – the standard size for one LAN – contains 18,446,744,073,709,551,616 addresses; a /48 site prefix holds 65,536 /64 subnets.
Frequently asked questions
How many hosts are in a /24?
254. A /24 has 256 addresses; the network and broadcast addresses are not usable for hosts.
What is a wildcard mask?
The inverted subnet mask, used in router ACLs and OSPF: 0.0.0.255 for a /24. A 0 bit means "must match", a 1 bit means "any value".
Is 172.20.5.1 a private address?
Yes. 172.16.0.0/12 covers 172.16.0.0 to 172.31.255.255.