IP Subnet Calculator
Calculate the subnet mask, network and broadcast address, usable host range and host count for any IPv4 address and CIDR prefix.
Network
192.168.1.0/24
Subnet Mask
255.255.255.0
Usable Host Range
192.168.1.1 – 192.168.1.254
Broadcast Address
192.168.1.255
Usable Hosts
254
Total Addresses
256
Wildcard Mask
0.0.0.255
Class / Type
C, private
Mask in Binary
11111111.11111111.11111111.00000000
IPv4 Subnetting: Mask, Network, Broadcast and Hosts
Enter an IPv4 address and choose the prefix length. The calculator returns the network in CIDR notation, the subnet and wildcard masks, the broadcast address, the first and last usable host addresses and the number of hosts, and says whether the address is private.
How it is calculated
- Subnet mask = prefix ones followed by (32 − prefix) zeros
- Network = IP AND mask; broadcast = network OR wildcard (inverted mask)
- Usable range = network + 1 to broadcast − 1
- Usable hosts = 2^(32 − prefix) − 2 (2 for /31, 1 for /32)
CIDR cheat sheet
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /20 | 255.255.240.0 | 4,094 |
| /22 | 255.255.252.0 | 1,022 |
| /23 | 255.255.254.0 | 510 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
Worked examples
1. 192.168.1.10/24 (the defaults). Mask 255.255.255.0, network 192.168.1.0, broadcast 192.168.1.255, hosts 192.168.1.1 to 192.168.1.254: 254 usable. Private (RFC 1918).
2. 192.168.1.130/26. Mask 255.255.255.192 (block size 64). 130 falls in the block 128 to 191: network 192.168.1.128, broadcast 192.168.1.191, hosts .129 to .190, 62 usable.
3. 172.16.5.20/20. Mask 255.255.240.0. The third octet block size is 16, so the network is 172.16.0.0 and the broadcast 172.16.15.255: 4,094 hosts.
4. 192.168.10.1/30 for a router link. Network .0, hosts .1 and .2, broadcast .3. A /31 (RFC 3021) uses both addresses with no broadcast.
Block size shortcut: 256 minus the last non-255 octet of the mask gives the step between subnets (256 − 192 = 64 for /26).
Related tools
- Convert addresses and masks to binary with the Binary Calculator.
- Network speed and transfer time: Bandwidth Calculator and Throughput Calculator.
Frequently Asked Questions
How do I calculate a subnet mask from a CIDR prefix?
Write the prefix number of ones followed by zeros to make 32 bits, then convert each group of 8 bits to decimal. /26 is 11111111.11111111.11111111.11000000 = 255.255.255.192.
How do I find the network address?
Do a bitwise AND of the IP address with the subnet mask. 192.168.1.130 AND 255.255.255.192 = 192.168.1.128.
How do I find the broadcast address?
Set all host bits to 1: network address OR wildcard mask. For 192.168.1.128/26 the broadcast is 192.168.1.191.
How many usable hosts are in a subnet?
2^(32 − prefix) − 2, because the network and broadcast addresses cannot be assigned. /24 has 254 usable hosts, /26 has 62, /30 has 2. /31 links use both addresses (RFC 3021) and /32 is a single host.
What is CIDR notation?
Classless Inter-Domain Routing writes a network as address/prefix, such as 10.0.0.0/8, where the prefix is the number of network bits. It replaced the old fixed class A, B and C networks.
What are private IP addresses?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. They are not routed on the internet and are translated (NAT) by your router.
What is a wildcard mask?
The inverse of the subnet mask (0s and 1s swapped), used in Cisco ACLs and OSPF. The wildcard for 255.255.255.0 is 0.0.0.255.
What are IP address classes?
Historic ranges by first octet: A 1 to 127, B 128 to 191, C 192 to 223, D 224 to 239 (multicast) and E 240 to 255 (reserved). Classes are no longer used for routing but are still taught.
Which subnet should I use for a home or office?
A /24 (254 hosts) suits most homes and small offices. Use /23 or /22 for larger networks, and /30 or /31 for point-to-point router links.
How do I split a network into subnets?
Each extra prefix bit halves the subnet: a /24 splits into two /25s (126 hosts each), four /26s (62 each) or eight /27s (30 each).
Related Calculators
Binary Calculator
Convert between decimal, binary, octal, and hexadecimal number systems. Perform bitwise AND, OR, XOR, NOT, and shift operations.
Bandwidth Calculator
Calculate network bandwidth required to transfer a file of given size in a specified time. Convert between bps, Kbps, Mbps, and Gbps.
Throughput Calculator
Calculate network or system throughput from data transferred and time period. Convert between bps, Mbps, Gbps and estimate daily capacity.
Storage Calculator
Convert between storage units (Bytes, KB, MB, GB, TB, PB) and calculate RAID usable capacity for different configurations.
Data Storage Converter
Convert between bytes, KB, MB, GB, TB and binary units (KiB, MiB)
CRC Calculator
Calculate Cyclic Redundancy Check (CRC) values using polynomial division. Enter data and generator polynomial to compute CRC checksum.
More in Computer Science · Engineering calculators · All calculators A–Z