IP Subnet Calculator
Find the network address, broadcast address, usable host range and wildcard mask for any IPv4 address, from CIDR notation or a subnet mask.
Calculate Subnet
Enter an IPv4 address with a prefix length, or an IP address and subnet mask
Calculating subnet...
Common CIDR Blocks
Calculate an IPv4 Subnet from CIDR or a Subnet Mask
Enter an IPv4 address with a prefix length, such as 192.168.1.77/24, or an IP address and subnet mask. The calculator gives you the network and broadcast addresses, the range of usable host addresses, how many hosts fit, the subnet mask in decimal and binary, the wildcard mask, and whether the address is private, public or in another special range.
The address you enter doesn't have to be the network address. Any address inside the subnet works, so you can paste a device's IP and prefix straight from its network settings. The calculator handles IPv4 only.
How to Use the Subnet Calculator
- CIDR Notation tab: type an address, a slash and the prefix length (0 to 32), for example 10.20.30.40/22.
- IP and Subnet Mask tab: type the IP address and the mask, either as 255.255.252.0 or as a prefix length such as 22.
- Press Calculate Network. The results appear below the form.
The calculation runs on the Orbit2x server and nothing you enter is saved.
Worked Example: 172.16.5.130/26
A /26 prefix means the first 26 bits are the network part and the last 6 bits identify hosts. 2⁶ = 64 addresses, so subnets start at every multiple of 64 in the last octet: .0, .64, .128 and .192. 130 falls in the block that starts at 128.
Subnet mask 255.255.255.192 (11111111.11111111.11111111.11000000) Wildcard mask 0.0.0.63 Network address 172.16.5.128 First usable host 172.16.5.129 Last usable host 172.16.5.190 Broadcast address 172.16.5.191 Usable hosts 62 (64 addresses minus network and broadcast) Address type Private (RFC 1918)The network address is the IP with every host bit set to 0 (a bitwise AND with the mask). The broadcast address has every host bit set to 1. The usable hosts are everything in between.
CIDR to Subnet Mask Table
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point) |
| /32 | 255.255.255.255 | 1 | 1 (single host) |
Usable hosts are the total minus 2, because the first address identifies the network and the last is the broadcast address. /31 and /32 are the exceptions: a /31 uses both addresses on a point-to-point link (RFC 3021), and a /32 is a single host.
What Each Result Means
- Network address
- The first address, which names the subnet itself. It's what you put in routing tables and firewall rules, such as 192.168.1.0/24. It isn't assigned to a device.
- Broadcast address
- The last address. A packet sent to it reaches every device on the subnet. It isn't assigned to a device either.
- First and last usable host
- The range you can give to devices. The router or gateway usually takes the first or last one, by convention rather than rule.
- Wildcard mask
- The subnet mask with every bit flipped (0.0.0.255 for a /24). Cisco access lists and OSPF network statements use it instead of a subnet mask.
- Address type
- Whether the address is in a special-purpose range: private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, from RFC 1918), carrier-grade NAT (100.64.0.0/10), loopback (127.0.0.0/8), link-local (169.254.0.0/16), documentation, multicast or reserved. Anything else is shown as public.
Frequently Asked Questions
How many hosts are in a /24?
256 addresses, of which 254 can be given to devices. The other two are the network address (.0) and the broadcast address (.255).
How do I convert a subnet mask to CIDR?
Count the 1 bits in the mask. 255.255.255.0 is 24 ones, so it's /24; 255.255.240.0 is 8 + 8 + 4 = 20 ones, so /20. Enter the mask on the IP and Subnet Mask tab and the result shows the prefix length.
Why is my subnet mask rejected?
A subnet mask's 1 bits must all come first, with no gaps. 255.255.255.0 and 255.255.248.0 are valid; 255.0.255.0 isn't, because there are 0 bits before some of the 1 bits.
What subnet size do I need for 50 devices?
A /26, which gives 62 usable addresses. A /27 gives only 30. Leave room to grow: a /25 (126 hosts) or a /24 (254) is common for an office network.
Can it calculate IPv6 subnets or split a network into smaller ones?
No. This calculator handles one IPv4 subnet at a time. To list every address in a block, use the IP range expander. IPv6 subnets are almost always /64, and addresses with an IPv4 address embedded in them can be decoded with the IPv6 to IPv4 converter.