Subnet Mask Calculator
Find the subnet mask for the hosts or subnets you need, convert CIDR to dotted mask and back, and get the wildcard mask. Full /0–/32 reference table.
| Prefix | Subnet mask | Wildcard | 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 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
The subnet mask decides how many addresses a network holds. This calculator answers the questions that come up when planning one: which mask fits 50 hosts, how small subnets get when a /24 is cut into five, what /20 looks like in dotted form, and which prefix a mask or wildcard mask such as 0.0.15.255 stands for. A full /0–/32 table is included for quick reference.
How to use this tool
- Pick what you know: hosts needed, subnets needed, a prefix, a dotted mask or a wildcard mask.
- Enter that value in its field (the other fields are ignored).
- Read the prefix, dotted mask, wildcard mask and host count.
- Use the reference table to compare neighbouring sizes.
Formula
usable hosts = 2^(32 − p) − 2 · smallest p with 2^(32 − p) − 2 ≥ hosts · new p = base p + ⌈log₂ subnets⌉
p is the prefix length (the number of 1-bits in the mask). A valid mask has all its 1-bits on the left; the wildcard mask is the same mask with every bit inverted, as used in Cisco ACLs and OSPF.
Example
You need 50 hosts on a LAN. A /27 holds 32 − 2 = 30 hosts, too few; a /26 holds 64 − 2 = 62, so the mask is 255.255.255.192 (/26) with wildcard 0.0.0.63, leaving 12 spare addresses. Dividing a /24 into 5 subnets needs 3 extra bits (2³ = 8 ≥ 5), giving /27 subnets of 30 hosts each.
Frequently asked questions
Why is 255.0.255.0 rejected?
Subnet masks must be contiguous: once a 0-bit appears, every bit after it is 0. 255.0.255.0 has 1-bits after 0-bits, so no prefix length matches it.
How many hosts does a /24 hold?
256 addresses, of which 254 can be assigned to hosts, because the first is the network address and the last the broadcast address.
When should I use /31?
On links between exactly two routers. RFC 3021 allows both addresses of a /31 to be used, which saves two addresses compared with a /30.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/subnet-mask-calculator/
Cite or embed this tool
kakaoCalc. (2026, November 8). Subnet Mask Calculator. https://kakao.mobile/tools/subnet-mask-calculator/
“Subnet Mask Calculator.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/subnet-mask-calculator/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms