How to use the subnet mask calculator
For several LANs with different host requirements, use the VLSM subnet planner to allocate non-overlapping blocks within a private parent network. To change the notation of one address without calculating a network, use the IP to hex, binary and decimal converter.
Learning the arithmetic? Try the subnetting practice quiz for questions, answer checks and worked explanations before returning to this calculator.
- Enter the IPv4 address you want to calculate, such as
192.168.1.42. The tool does not discover an address automatically. - Choose a CIDR prefix, or switch to Subnet mask and enter a contiguous dotted-decimal mask.
- Select Calculate subnet. Read the network prefix, entire block range, mask, wildcard and count interpretation.
- Confirm the plan against the actual network allocation and device configuration before applying it anywhere.
Nothing is calculated automatically on page load. Reset restores the private example and clears the result. Copy summary copies only a completed calculation. No address is contacted, saved in browser storage or added to result analytics by this calculator.
IPv4 subnet mask cheat sheet
All 33 prefix lengths are listed below. On a small screen, scroll inside the table to see every column. You can also use your browser’s Print command for the reference.
| CIDR | Subnet mask | Wildcard mask | Total addresses | Host slots / special case | Count interpretation |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | Conventional |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | Conventional |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | Conventional |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | Conventional |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | Conventional |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | Conventional |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | Conventional |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | Conventional |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | Conventional |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | Conventional |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | Conventional |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | Conventional |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | Conventional |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | Conventional |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | Conventional |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | Conventional |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Conventional |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | Conventional |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | Conventional |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | Conventional |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | Conventional |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | Conventional |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | Conventional |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | Conventional |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Conventional |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | Conventional |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | Conventional |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | Conventional |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Conventional |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | Conventional |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Conventional |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | Point-to-point only¹ |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Single address² |
¹ A /31 provides two endpoint addresses only in the compatible point-to-point use described by RFC 3021. ² A /32 identifies one address, often represented as a host route. Neither case uses the conventional total-minus-two formula. For /0–/30, the host column is a conventional arithmetic count; it does not establish operational assignability.
What a CIDR prefix and subnet mask mean
IPv4 addresses contain 32 bits. A prefix length /p counts the leading network bits; the remaining 32 − p bits describe positions within that block. The subnet mask has that many leading one bits followed by zero bits.
The block contains 2(32 − p) addresses. The network is the address combined with the mask using bitwise AND. The wildcard is the 32-bit inverse of the mask. The last address in the block is the network combined with that wildcard using bitwise OR.
A wildcard value is useful in some configuration systems, but it is not a substitute for a subnet mask. This form accepts only contiguous subnet masks, not arbitrary access-control wildcards. This is classless CIDR arithmetic, not an assumption that a network belongs to an old class A, B or C.
Worked example: 192.168.1.42/24
The /24 mask is 255.255.255.0 and the wildcard is 0.0.0.255. The input belongs to 192.168.1.0/24, whose complete range is 192.168.1.0–192.168.1.255.
There are 256 total addresses. Under conventional subnet interpretation, the first address identifies the subnet and the last is its directed broadcast, leaving 254 host-address slots from 192.168.1.1 to 192.168.1.254. A DHCP pool, gateway reservation or other operational rule can make the usable configuration smaller.
Why /31 and /32 need separate explanations
For 10.0.0.10/31, the two addresses are 10.0.0.10 and 10.0.0.11. RFC 3021 permits both to be interpreted as host addresses on a compatible point-to-point link. This does not mean every ordinary LAN or device will support that arrangement.
For 192.168.1.42/32, the block has exactly one address. It is commonly used to express a single host route. The calculator does not invent a separate directed-broadcast address or subtract two from one.
At the other boundary, /0 spans 4,294,967,296 addresses. That is a mathematical description of the entire IPv4 space; it is not a usable public allocation. It includes special-purpose, private and other restricted space.
Subnet arithmetic is not a network diagnostic
The calculator does not scan a subnet, identify a gateway, inspect a router, configure DHCP, ping an address or determine which addresses are free. It also does not prove an address can be routed globally. The IANA special-purpose registry and your actual network policy remain relevant.
For a naming question, use DNS Lookup. For browser endpoint reachability, use the separate IPv4/IPv6 connectivity test. The Open Port Checker checks one TCP port on the public address observed for its own request, rather than scanning an entered subnet.
Subnet mask questions
What does this subnet mask calculator calculate?
It performs local IPv4 address arithmetic for an entered address and CIDR prefix or contiguous subnet mask. It shows the network, mask, wildcard, address range and conventional host counts. It does not contact the address, discover your network, check availability or change any settings.
How do I convert a subnet mask to a CIDR prefix?
Choose Subnet mask in the input selector and enter a contiguous mask such as 255.255.255.0. The calculator returns its equivalent /24 prefix. A valid subnet mask contains consecutive one bits followed by zero bits; a wildcard mask is a different value.
Why are /31 and /32 different from the usual host-count formula?
For conventional /0 through /30 subnet arithmetic, this reference subtracts the first and last addresses from the total. RFC 3021 allows both /31 addresses as endpoints on a compatible point-to-point link. A /32 identifies one address or host route, so there is no separate network/broadcast pair to subtract.
Does a host count mean I may assign every listed address?
No. The displayed counts are mathematical slots, not an allocation or routability check. Special-purpose addresses, provider and device rules, DHCP pools, reserved addresses and your actual configuration can limit use. Consult the current IANA registry and your network administrator.
Does this work for IPv6 or test whether an IP address is reachable?
No. This page calculates IPv4 subnet values only. It does not send ping, TCP, DNS or other test traffic. The separate IPv4/IPv6 connectivity tool checks named HTTPS endpoints; it is a different diagnostic task.
More practical tools
For another task, explore all internet tools or the separate Internet Speed Test.
Calculation method and sources
The interactive calculation uses unsigned integer arithmetic for the 32-bit IPv4 value, rather than signed JavaScript 32-bit operators. The table uses the same prefix definitions. No input address is looked up or transmitted as part of the calculation.
- RFC 4632: classless addressing and prefix notation
- RFC 1878: historical IPv4 subnet reference tables
- RFC 3021: /31 point-to-point interpretation
- IANA: current IPv4 special-purpose registry
- Instant Speed Test methodology and tool limits
RFC 1878 is an older reference. The /31 explanation here follows the later point-to-point specification, and address-policy questions should use current registries and network documentation.