Subnet Calculator
IPv4 subnet from an address and CIDR prefix: network and broadcast addresses, usable host range and count, subnet mask and wildcard mask, with exact 32-bit maths.
Subnet Calculator: with the default inputs, network address is 192.168.1.128.
The number after the slash: /24 is a 255.255.255.0 mask, /26 splits that into four.
The first address in the block. It identifies the subnet and is not assignable to a host.
- Broadcast address
- 192.168.1.191
- Usable host range
- 192.168.1.129 – 192.168.1.190
- Usable hosts
- 62
- Subnet mask
- 255.255.255.192
- Wildcard mask
- 0.0.0.63
- Network in CIDR notation
- 192.168.1.128/26
- Total addresses in the block
- 64
- Host bits
- 6
- Address type
- Private (RFC 1918, 192.168.0.0/16)
Assumptions
- IPv4 only; IPv6 uses 128-bit prefixes and no broadcast address.
- Usable host count is 2^host_bits − 2, except /31 (2) and /32 (1).
- Exact 32-bit unsigned integer arithmetic — no floating-point rounding anywhere in the address maths.
- Address type is reported from the reserved-range registries, not from the obsolete class A/B/C rules.
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /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 |
Each step down the table halves the block. Usable hosts is total minus 2, except /31 (RFC 3021 point-to-point, both usable) and /32 (a single host route).
How this is worked out
The formula
mask = 32 bits, with the top <prefix> bits set to 1 network = IP AND mask broadcast = network OR NOT(mask) wildcard = NOT(mask) total addresses = 2^(32 − prefix) usable hosts = 2^(32 − prefix) − 2 (except /31 → 2 and /32 → 1)
Open How it’s calculated above to see this worked through with your own numbers.
What you enter
- IP address — first octet
- A number.from 0 to 255 · whole numbers only · defaults to 192
- Second octet
- A number.from 0 to 255 · whole numbers only · defaults to 168
- Third octet
- A number.from 0 to 255 · whole numbers only · defaults to 1
- Fourth octet
- A number.from 0 to 255 · whole numbers only · defaults to 130
- CIDR prefix length
- The number after the slash: /24 is a 255.255.255.0 mask, /26 splits that into four.from 0 to 32 · whole numbers only · defaults to 26
What you get back
- Network addressmain answer
- The first address in the block. It identifies the subnet and is not assignable to a host.
- Broadcast address
- Usable host range
- Usable hosts
- Subnet mask
- Wildcard mask
- Network in CIDR notation
- Total addresses in the block
- Host bits
- Address type
What this assumes
- IPv4 only; IPv6 uses 128-bit prefixes and no broadcast address.
- Usable host count is 2^host_bits − 2, except /31 (2) and /32 (1).
- Exact 32-bit unsigned integer arithmetic — no floating-point rounding anywhere in the address maths.
- Address type is reported from the reserved-range registries, not from the obsolete class A/B/C rules.
About this calculator
Subnetting is bitwise AND, done on 32 bits and written in four decimal chunks so humans can read it. The prefix says how many leading bits identify the network; everything after them identifies a host inside it. Enter an address and a prefix and you get the network and broadcast addresses, the usable range, the mask and the wildcard.
How the arithmetic works
A /26 mask is 26 ones followed by 6 zeros: 11111111.11111111.11111111.11000000, which is 255.255.255.192. AND your address with that and the host bits vanish, leaving the network address. OR the network with the inverted mask and every host bit turns on, giving the broadcast address.
Worked through for 192.168.1.130/26: the last octet 130 is 10000010, the mask's last octet is 11000000, and the AND is 10000000 = 128. So the network is 192.168.1.128, the broadcast is 192.168.1.191, and the usable hosts run .129 to .190 — 62 of them. The 6 host bits give 64 addresses; two are spoken for.
The two you cannot use
Every subnet spends its first address on the network identifier and its last on the directed broadcast. That is why a /24 hosts 254 devices, not 256, and why the penalty for small subnets is savage: a /30 gives you 4 addresses and 2 usable ones — 50% overhead — which is why point-to-point links between routers are exactly that size.
Two exceptions:
- /31 (RFC 3021) has no network or broadcast address by definition and gives you both addresses for a point-to-point link. Modern routers support it; older equipment does not.
- /32 is a single address — a host route, a loopback, or an ACL entry matching one machine.
Masks, wildcards, and where each is used
The subnet mask (255.255.255.192) is what you configure on an interface. The wildcard mask (0.0.0.63) is its bitwise inverse and is what Cisco ACLs and OSPF network statements want. They carry the same information, inverted, and mixing them up is one of the most common configuration errors there is.
Sizing a subnet
Work backwards from hosts: you need host_bits where 2^host_bits − 2 ≥ your device count, then prefix = 32 − host_bits. 100 devices needs 7 bits (126 usable), so a /25. Always round up and leave room — resizing a subnet in production means renumbering every static address, every firewall rule and every DNS record on it.
Do not size on today's count. DHCP leases outlive devices, and phones, printers, cameras, badge readers and guest devices all consume addresses.
What this does not do
- IPv4 only. IPv6 subnetting is 128 bits, uses /64 for essentially every LAN, and has no broadcast address at all.
- Classful addressing (A/B/C) has been obsolete since CIDR arrived in 1993. The address type shown here is about the use of the range (private, loopback, multicast), not its old class.
- It does not check whether the address is actually assigned, reachable, or in use.
- VLSM — splitting one block into unequal subnets — is done by applying this same calculation repeatedly, one subnet at a time.
Frequently asked questions
▸How many hosts are in a /26?
- A /26 leaves 6 host bits, so 2⁶ = 64 addresses, minus the network address and the broadcast address.
▸What is the network address of 192.168.1.130/26?
192.168.1.128. The /26 mask is 255.255.255.192, and 130 AND 192 = 128. The broadcast is 192.168.1.191 and hosts run .129 to .190.
▸What is a wildcard mask?
The bitwise inverse of the subnet mask — 255.255.255.192 becomes 0.0.0.63. Cisco access lists and OSPF network statements use wildcards, where a 0 bit means 'must match'.
▸Why can't I use the first and last address?
The first identifies the subnet itself and the last is the directed broadcast for it. The exceptions are /31, where RFC 3021 makes both usable on point-to-point links, and /32, a single host route.
▸What size subnet do I need for 100 devices?
A /25: 7 host bits give 126 usable addresses. A /26 tops out at 62, and you want headroom for DHCP churn, printers and guest devices anyway.
Put this calculator on your own site
A working subnet, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.
Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.
Subnet Calculator by CalculateItNow
The page's own title. The clearest description of what the link leads to.
The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.
Browse every calculator widget·How to add it to WordPress, Squarespace or Wix
Related calculators
The questions people ask next to a subnet.
Bandwidth for a given number of concurrent users and activity, with overhead headroom, the same figure in MB/s, and the monthly data transfer it adds up to.
Password entropy in bits from length and character set, with the size of the search space and the time to crack at a guess rate you set.
How long a file takes to transfer at a given connection speed, in bits or bytes, with a real-world overhead allowance and the speed needed to hit a deadline.
Raise any base to any power — negative, fractional or huge — with the expanded multiplication, scientific notation and the rule that applies shown.