Subnet Calculator
Including the /31 and /32 that most calculators get wrong.
Work out the network address, broadcast, usable host range and mask for any IPv4 address and prefix, split a block into subnets, and size one to a host count.
Try one of these
How big a subnet do I need?
A /26 — mask 255.255.255.192, holding 62 usable addresses.
- Subnet mask
- 255.255.255.192
- Wildcard mask
- 0.0.0.63
- Network address
- 192.168.1.128
- Broadcast address
- 192.168.1.191
- First usable host
- 192.168.1.129
- Last usable host
- 192.168.1.190
- Total addresses
- 64
- Usable hosts
- 62
- Legacy class
- C
The inverse, which is what an ACL or an OSPF statement wants
Not assignable to a host
Not assignable to a host
Classful addressing ended in 1993 with CIDR. Kept because exams still ask
Private address
RFC 1918, and the range almost every home router uses.
Split this /26 into smaller subnets
4 subnets of 14 usable hosts each.
| Network | First host | Last host | Broadcast |
|---|---|---|---|
| 192.168.1.128/28 | 192.168.1.129 | 192.168.1.142 | 192.168.1.143 |
| 192.168.1.144/28 | 192.168.1.145 | 192.168.1.158 | 192.168.1.159 |
| 192.168.1.160/28 | 192.168.1.161 | 192.168.1.174 | 192.168.1.175 |
| 192.168.1.176/28 | 192.168.1.177 | 192.168.1.190 | 192.168.1.191 |
All of this is exact arithmetic on 32 bits, done in the browser. One detail worth knowing if you ever write it yourself: JavaScript’s bitwise operators are signed, so any address above 127 in the first octet comes back negative unless every step ends in an unsigned shift. It is the reason a surprising number of home-made subnet tools work perfectly on 192.168 and fall apart on 200.100.
How the Subnet Calculator works
Exact arithmetic on 32 bits, with the two edge cases most calculators fail. A /31 has two usable addresses under RFC 3021, not zero, and it is the configuration on a great many point-to-point links. A /32 is one host, not minus one.
Also known as: cidr calculator · ip subnet calculator · subnet mask calculator · network address calculator · cidr to subnet mask
Frequently asked questions
How many usable hosts are in a subnet?
Two to the power of the host bits, less two for the network and broadcast addresses — so a /24 holds 254 and a /26 holds 62. The exceptions are the ones that matter: a /31 has two usable addresses under RFC 3021 because a point-to-point link has two ends and needs no broadcast, and a /32 is a single host. Applying the general formula to those gives zero and minus one, which is how you spot a calculator that has not thought about it.
What is a /31 for?
Router-to-router links. Before RFC 3021 the smallest sensible block for a point-to-point connection was a /30, which spends four addresses to use two. A /31 assigns both of its addresses to hosts, halving the waste, and every current router platform supports it. On a backbone with thousands of links that saving is substantial.
What is the difference between a subnet mask and a wildcard mask?
They are inverses. A subnet mask such as 255.255.255.192 marks the network bits with ones; the wildcard 0.0.0.63 marks the host bits instead. Cisco access lists and OSPF network statements take the wildcard, which is why typing a subnet mask into an ACL silently matches the wrong thing rather than erroring.
Which address ranges are private?
Three, from RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The middle one is the one people misremember — it covers 172.16 through 172.31 only, so 172.15 and 172.32 are ordinary public addresses belonging to somebody else. Also worth knowing is 100.64.0.0/10, carrier-grade NAT space, which is neither private nor public and shows up on mobile and some fibre connections.
Are IP classes still used?
No. Classful addressing ended in 1993 when CIDR replaced it, and a modern network is defined by its prefix rather than by whether its first octet happens to be under 128. The class is shown here because certification exams still ask about it, not because anything routes that way.
Why is 255.255.0.255 not a valid subnet mask?
Because a mask has to be an unbroken run of ones followed by an unbroken run of zeros. Non-contiguous masks were legal in the classful era and are not now, and no current equipment will accept one. It is rejected here rather than being silently interpreted, since any answer derived from it would be meaningless.
Related calculators
Regex Tester
Test a pattern, and read what it actually says in English.
OpenUUID Generator
Version 4 UUIDs, correct to RFC 9562, as many as you need.
OpenHash Generator
MD5, SHA-1 and SHA-2 for text or a file, with a checksum check built in.
Open