IPv4 Subnet Calculator
Enter an IPv4 address with its CIDR prefix, such as 192.168.1.10/24, or with a dotted-decimal subnet mask. Read the network address, broadcast, usable host range, address count and wildcard mask together. The bit diagram shows the network and host portions; the split controls divide a block into two, four or eight equal subnets. /31 point-to-point links and /32 host routes use their special host-count rules.
CIDR prefix to subnet mask reference
IPv4 prefix lengths /0 through /32, with subnet masks, wildcard masks and address counts. Usable hosts excludes network and broadcast addresses through /30; /31 and /32 use the documented exceptions.
| CIDR | Subnet mask | Wildcard | Total addresses | Usable hosts |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (RFC 3021 point-to-point) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (single host route) |
Common questions
- What is the difference between a /24 and a netmask of 255.255.255.0?
- Nothing. They are two notations for the same mask. The prefix counts the leading 1 bits; the netmask writes those bits out in dotted decimal. Both are accepted here, and both are shown in the results.
- Why does a /24 have 254 usable hosts and not 256?
- A /24 holds 256 addresses, but the first is the network address and the last is the broadcast address, so 254 remain for hosts. That subtraction applies to every prefix from /0 through /30.
- What about /31 and /32?
- They are the exceptions. A /32 is a single host route: one address, no network or broadcast. A /31 has two addresses and, under RFC 3021, both are usable on a point-to-point link; neither is reserved. This calculator reports 2 usable hosts for a /31 rather than the 0 that a naive formula gives.
- What is the wildcard mask for?
- It is the bitwise inverse of the netmask, and it is what Cisco access lists and OSPF network statements expect instead of a netmask. A /24 netmask of 255.255.255.0 has a wildcard of 0.0.0.255.
- Does an address outside the private ranges have to be publicly routable?
- No. RFC 1918 private-use space is 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Loopback (127.0.0.0/8), link-local (169.254.0.0/16), documentation, multicast and other special-purpose ranges have different roles. The calculator gives address arithmetic, not a guarantee that an address can be routed or assigned on your network.
- Is my address sent anywhere?
- No. The whole calculation is integer arithmetic that runs in your browser. Nothing is uploaded, logged or stored on a server, which is worth knowing if you are working with internal addressing plans.
- How do I convert a subnet mask to CIDR?
- Enter an address followed by the mask, for example 192.0.2.10 255.255.255.192. The result shows 192.0.2.0/26, so the mask is /26. A mask must contain contiguous leading 1 bits. The full prefix table below also converts a mask to its prefix without entering an address.
- How do I split a network into equal subnets?
- Enter the starting block and select one of the three longer prefixes under Split into. Each extra prefix bit halves the address count and doubles the number of subnets. Splitting 192.0.2.0/24 at /26 produces four blocks: 192.0.2.0/26, 192.0.2.64/26, 192.0.2.128/26 and 192.0.2.192/26. These are equal-sized subdivisions; the tool does not allocate variable-sized networks from a list of host requirements.
- How can I find the first and last usable IP addresses?
- Supply the address and its actual prefix or mask. For 192.0.2.10/26, the network is 192.0.2.0, the broadcast is 192.0.2.63, and the usable host range is 192.0.2.1 through 192.0.2.62. A /31 point-to-point block uses both addresses, and a /32 contains one host address. A gateway is chosen as part of the network configuration; it is not determined by this calculation.
- Can the calculator discover my subnet mask from an IP address alone?
- No. A bare IPv4 address opens with a /24 assumption, which may not match your network. Include the prefix or subnet mask from your network configuration to calculate the correct block. This page does not inspect your device, discover its gateway or query a network.
- Can I use the subnet calculator on a Mac, Windows PC or phone?
- Yes. It runs in a browser on a Mac, Windows PC, Android phone or other device with a modern browser. No native application or account is required. Your last address is stored only in this browser; the calculation does not contact your network.
- What formula gives the subnet address count?
- An IPv4 address has 32 bits. A prefix of p leaves 32 − p host bits, so the block contains 2^(32 − p) addresses. For example, /26 has 2^6 = 64 addresses and normally 62 usable hosts after reserving network and broadcast. A /31 point-to-point link uses both of its two addresses, and a /32 is one host route.
Exact. All addressing is computed with integer bit arithmetic, so network, broadcast, host range and mask are correct for every prefix from /0 to /32, including the /31 point-to-point and /32 host-route special cases.