IPv4 Subnet Calculator
Free IPv4 subnet calculator: enter 192.168.1.130/26 for the network address, broadcast, usable host range, netmask and wildcard, plus paste-ready Cisco and Linux config.
- CIDR notation
- Network address
- Broadcast address
- Usable host range
- Usable hosts
- Total addresses
- Subnet mask
- Wildcard mask
| Network address | |
| Subnet mask | |
| Broadcast address |
- Network as integer
- Network as hex
- Reverse DNS (PTR)
| Cisco IOS interface | ||
| Cisco ACL (wildcard) | ||
| OSPF network statement | ||
| Cisco ASA (netmask) | ||
| Huawei / H3C | ||
| Linux iproute2 |
Cisco IOS ACLs and OSPF take the wildcard mask; the ASA takes the subnet mask instead. Mixing the two is the most common copy-paste failure in this area.
| # | Subnet | Usable range | Broadcast | Hosts |
|---|
| Prefix | Subnet mask | Wildcard mask | Total 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 |
Usable-host counts follow RFC 3021 for /31 (two usable addresses on a point-to-point link) and treat /32 as a single host route.
Written and reviewed by engineers who build network tooling, with every address, mask and host count in these examples generated by the calculator's own tested engine.
What Is a Subnet Mask?
A subnet mask splits a 32-bit IPv4 address into two parts: a network portion that every host on the segment shares, and a host portion that identifies the individual machine. The mask is itself 32 bits — a run of 1s marking the network bits followed by 0s marking the host bits — which is why 255.255.255.0 and /24 describe exactly the same thing. CIDR notation just counts the 1 bits instead of spelling them out in decimal.
Everything else follows from that split. Zero out the host bits and you have the network address; set them all to 1 and you have the directed broadcast address; the addresses between the two are what you can assign to hosts. That is where the familiar 2^n − 2 formula comes from, and also why a /26 yields 62 usable hosts rather than 64. When a machine decides whether a destination is local or needs a router, it applies its own mask to both addresses and compares the results — which is precisely the membership test this calculator performs.
Two prefixes break the pattern on purpose. A /31 has only two addresses, leaving no room for a separate network and broadcast; RFC 3021 therefore makes both usable on point-to-point links, and every current router platform honours that. A /32 is a single host route, used for loopback interfaces, static routes, anycast addresses and single-address firewall rules. Applying 2^n − 2 blindly to either one yields 0 usable hosts — an answer no router platform agrees with. The /31 exception carries its own condition: it works only on genuinely point-to-point interfaces, so a shared LAN segment still needs /30 or shorter.
The address you type also carries meaning beyond its mask. 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private (RFC 1918) and never routed on the public internet; 100.64.0.0/10 is carrier-grade NAT space; 169.254.0.0/16 appears when DHCP fails; 224.0.0.0/4 is multicast. Historical classes A through E still surface in documentation and certification exams, but classful routing has been obsolete since CIDR arrived in 1993 — the mask, not the first octet, decides where a network ends. To inspect the same address in binary or hexadecimal by hand, the number base converter does the arithmetic.
// Subnetting is integer arithmetic on a 32-bit value.
const toInt = (ip) => ip.split('.').reduce((acc, o) => acc * 256 + Number(o), 0);
const toIp = (n) => [24, 16, 8, 0].map((s) => (n >>> s) & 255).join('.');
function subnet(ip, prefix) {
const mask = prefix === 0 ? 0 : (0xFFFFFFFF << (32 - prefix)) >>> 0;
const network = (toInt(ip) & mask) >>> 0;
const broadcast = (network | (~mask >>> 0)) >>> 0;
// RFC 3021: a /31 has two usable addresses; a /32 has one.
const usable = prefix >= 31 ? 2 ** (32 - prefix) : 2 ** (32 - prefix) - 2;
return { network: toIp(network), broadcast: toIp(broadcast), usable };
}
subnet('192.168.1.130', 26);
// { network: '192.168.1.128', broadcast: '192.168.1.191', usable: 62 } Key Features
Every field, one screen
Network address, broadcast, first and last usable host, usable and total counts, subnet mask and wildcard mask update as you type — no submit button, no page reload, no waiting.
Correct /31 and /32 handling
A /31 reports two usable addresses per RFC 3021 and a /32 reports one, with an inline note explaining why — and when /31 is not safe to use. Applying 2^n − 2 to these prefixes yields zero, which no router agrees with.
Prefix slider from /0 to /32
Drag the prefix and watch the boundary move one bit at a time while the address stays put — the fastest way to answer 'how big does this block need to be?'
Binary view with the mask boundary coloured
Network bits and host bits are drawn in different colours across the network, mask and broadcast rows, so the cut point is visible rather than implied.
Subnet division table
Split any block into equal child subnets at a longer prefix and read their ranges, broadcast addresses and host counts — the VLAN plan sanity check, without a spreadsheet.
Block identification and reverse DNS
A badge names the block your address belongs to (RFC 1918 private, CGNAT, link-local, documentation, benchmarking, multicast, reserved) alongside its integer, hex and in-addr.arpa forms.
Subnet Calculation Examples
Which subnet does 192.168.1.130/26 belong to? — the classic exam question
192.168.1.130/26
Network: 192.168.1.128 Broadcast: 192.168.1.191 Usable: 192.168.1.129 - 192.168.1.190 Hosts: 62 usable of 64 total Netmask: 255.255.255.192 Wildcard: 0.0.0.63
You typed a host address, not a network address, and that is the point: a /26 mask has 6 host bits, so blocks step every 64 addresses — 0, 64, 128, 192. The address 192.168.1.130 lands in the third block, which is why the network is 192.168.1.128 and not 192.168.1.0. The broadcast is the top of that block (192.168.1.191), leaving 192.168.1.129 through 192.168.1.190 assignable. This is the single most common subnetting mistake: assuming the network address is whatever you typed with the host part zeroed by eye.
Network address, broadcast and usable hosts of 10.0.0.0/22
10.0.0.0/22
Network: 10.0.0.0 Broadcast: 10.0.3.255 Usable: 10.0.0.1 - 10.0.3.254 Hosts: 1,022 usable of 1,024 total Netmask: 255.255.252.0 Wildcard: 0.0.3.255
A /22 borrows two bits from the third octet, so the block covers 10.0.0.x through 10.0.3.x — four consecutive /24s in one broadcast domain. The mask 255.255.252.0 is where people slip: 252 is 11111100 in binary, so the third octet increments in steps of 4 (10.0.0.0, 10.0.4.0, 10.0.8.0). The binary view in the tool colours the two borrowed bits, and the division table splits this block back into its four /24s.
A /31 point-to-point link: two usable addresses, not zero
203.0.113.4/31
Addresses: 203.0.113.4 and 203.0.113.5 Usable: 2 (both ends of the link) Broadcast: none Netmask: 255.255.255.254 Wildcard: 0.0.0.1
RFC 3021 defines /31 for point-to-point links: because such a link has exactly two endpoints and no shared segment, the network and broadcast addresses are dropped and both addresses are assignable. Applying the generic 2^n − 2 formula here yields 0 usable hosts, which is wrong on any modern router — Cisco IOS, Junos and Linux all support /31 on point-to-point interfaces. Using /31 instead of /30 halves the address waste on router-to-router links. The catch is that it is only valid on genuinely point-to-point interfaces: a multi-access LAN segment needs /30 or shorter, and Windows will not accept a /31 on a NIC. The example uses 203.0.113.0/24 because RFC 5737 reserves it for documentation.
Dividing 192.168.1.0/24 into four /26 subnets
192.168.1.0/24 → /26
192.168.1.0/26 192.168.1.1 - 192.168.1.62 bc 192.168.1.63 62 hosts 192.168.1.64/26 192.168.1.65 - 192.168.1.126 bc 192.168.1.127 62 hosts 192.168.1.128/26 192.168.1.129 - 192.168.1.190 bc 192.168.1.191 62 hosts 192.168.1.192/26 192.168.1.193 - 192.168.1.254 bc 192.168.1.255 62 hosts
Borrowing two bits from a /24 produces four equal subnets of 64 addresses each, 62 of them usable. Note that each child subnet loses its own network and broadcast address, so dividing a /24 into four /26s costs you 254 − 248 = 6 usable addresses in total. The division table prints this layout for any parent block and any longer prefix, which is the fastest way to sanity-check a VLAN plan before it reaches a router.
CIDR to subnet mask table: /24 is 255.255.255.0
/24, /25, /26, /27, /28, /29, /30, /31, /32
/24 255.255.255.0 256 addresses 254 usable /25 255.255.255.128 128 addresses 126 usable /26 255.255.255.192 64 addresses 62 usable /27 255.255.255.224 32 addresses 30 usable /28 255.255.255.240 16 addresses 14 usable /29 255.255.255.248 8 addresses 6 usable /30 255.255.255.252 4 addresses 2 usable /31 255.255.255.254 2 addresses 2 usable (RFC 3021) /32 255.255.255.255 1 address 1 usable (host route)
Each extra prefix bit halves the block. The last two rows are the ones worth memorising because they break the 2^n − 2 pattern: a /31 has two usable addresses (point-to-point, no broadcast) and a /32 is a single host route used for loopback interfaces, ACL entries and static routes. The full table from /8 to /32 is rendered under the calculator and is generated by the same engine that powers it.
How to Use the IPv4 Subnet Calculator
- 1
Enter an address or CIDR block
Type 192.168.1.130/26, paste 10.0.0.0 255.255.252.0, or enter a bare address and set the prefix with the slider. A host address is fine — the tool masks it down to its network for you.
- 2
Move the prefix slider to see the boundary shift
Drag from /0 to /32 and watch the host count, mask and broadcast address recalculate. The slider keeps your address fixed, so it answers 'what if I resize this block?' in one gesture.
- 3
Read the subnet details
Network address, broadcast, first and last usable host, usable and total counts, subnet mask and wildcard mask — plus a badge naming the block (private, CGNAT, link-local, documentation, multicast) and its historical class.
- 4
Check the binary view and address forms
Network bits and host bits are coloured separately so the mask boundary is visible bit by bit. The same panel gives the network as an integer, as hexadecimal, and as a reverse-DNS in-addr.arpa name.
- 5
Test membership and divide the block
Paste any address to confirm whether it falls inside the current subnet, then pick a longer prefix to split the block into equal child subnets with their ranges, broadcasts and host counts.
Common Subnetting Mistakes
Assuming the address you typed is the network address
A host address masked with a /26 rarely sits at the start of its block. The network is whatever remains after zeroing the host bits, which is why 192.168.1.130/26 belongs to 192.168.1.128, not 192.168.1.0.
192.168.1.130/26 -> network 192.168.1.0, broadcast 192.168.1.255
192.168.1.130/26 -> network 192.168.1.128, broadcast 192.168.1.191
Applying 2^n - 2 to a /31
The minus-two rule assumes a network and a broadcast address exist. On a /31 point-to-point link they do not, and RFC 3021 makes both addresses assignable. Reporting zero usable hosts here contradicts every current router platform.
203.0.113.4/31 -> 0 usable hosts
203.0.113.4/31 -> 2 usable hosts (203.0.113.4 and 203.0.113.5)
Treating 172.16.0.0/12 as 172.16.x.x only
The private range spans 172.16.0.0 through 172.31.255.255 — sixteen /16s, not one. Addresses in 172.15.x.x and 172.32.x.x are public and belong to somebody else.
172.20.5.1 -> assumed public because it is not 172.16.x.x
172.20.5.1 -> private, inside 172.16.0.0/12 (172.16.0.0 - 172.31.255.255)
Writing a non-contiguous subnet mask
A subnet mask must be a solid run of 1s followed by 0s. Values like 255.0.255.0 are not valid masks, even though ACL wildcards are allowed to have gaps. Devices reject them, and a calculator that accepts them is hiding a typo.
10.0.0.0 255.0.255.0
10.0.0.0 255.255.252.0 (= 10.0.0.0/22)
What You Can Do with the Subnet Calculator
- Plan VLANs and address blocks
- Divide an allocation into equal subnets, confirm each one is large enough for its host count, and copy the layout straight into your IPAM spreadsheet or design document before it reaches a switch.
- Write firewall rules and ACLs
- Read the wildcard mask for Cisco ACLs and OSPF network statements, and confirm the exact address range a rule will match — the difference between 0.0.0.63 and 0.0.0.31 is two VLANs' worth of hosts.
- Troubleshoot a host that cannot reach the gateway
- Paste the host address and the mask it was configured with, then check whether the gateway falls inside the resulting subnet. A mismatched mask is the classic cause of 'it pings some things but not others'.
- Number router-to-router links efficiently
- Compare /30 against /31 for point-to-point links: the /31 gives both endpoints an address instead of wasting two per link, which adds up quickly across a WAN with hundreds of circuits.
- Study for CCNA, Network+ and similar exams
- Work a subnetting question by hand, then check the network address, broadcast and host range here. The binary view shows the borrowed bits, which is what the exam is actually testing.
How IPv4 Subnetting Works
- The mask is a bit boundary, not a decimal value
- A subnet mask is 32 bits: a contiguous run of 1s for the network, then 0s for hosts. Only 33 masks are valid (/0 through /32), which is why 255.255.255.192 is legal and 255.0.255.0 is not — the latter has a hole in it. This calculator rejects non-contiguous masks rather than guessing what you meant.
- Block size and the fourth-octet shortcut
- Subnets of the same size sit on multiples of their block size, and the block size is 256 minus the relevant mask octet. A /26 ends in 192, so blocks start at 0, 64, 128 and 192; a /28 ends in 240, so they step every 16. This is the arithmetic behind 'which subnet does 192.168.1.130 belong to?' — it is the third /26 block, hence 192.168.1.128.
- Reserved addresses and the two exceptions
- The all-zeros host address identifies the network and the all-ones host address is the directed broadcast, so ordinary subnets lose two addresses. RFC 3021 waives both for /31 point-to-point links (two usable addresses), and a /32 is a single host route (one usable address). The reference table under the calculator follows those rules, so its /31 row reads 2 rather than 0.
- Wildcard masks and where they are required
- The wildcard mask is the bitwise inverse of the subnet mask — 255.255.255.192 inverts to 0.0.0.63. Cisco ACLs, OSPF network statements and EIGRP take wildcards instead of masks. Unlike subnet masks, ACL wildcards may be non-contiguous, which is how a single rule can match every odd-numbered address in a range.
- Classes are history, blocks are current
- Class A/B/C/D/E divides the address space by first octet (0–127, 128–191, 192–223, 224–239, 240–255) and is still taught and examined, but CIDR replaced classful routing in 1993 — the mask decides where a network ends, not the leading bits. What does still matter is which reserved block an address falls into: RFC 1918 private, RFC 6598 CGNAT, RFC 3927 link-local, RFC 5737 documentation, RFC 2544 benchmarking, multicast and the 240.0.0.0/4 reserved range.
IP Addressing Best Practices
- Size the subnet for growth, but not by a factor of ten
- A /24 for eight devices wastes 246 addresses and enlarges the broadcast domain for no benefit. Pick the smallest prefix that leaves comfortable headroom — the calculator's host count makes the trade-off explicit before you commit.
- Use /31 on point-to-point links
- On router-to-router circuits a /31 gives both ends an address instead of burning four addresses for two endpoints. Reserve /30 for equipment that genuinely predates RFC 3021 support, and never put a /31 on a multi-access segment.
- Allocate on a bit boundary, not on round decimal numbers
- Address plans that start blocks at 10.0.10.0 or 10.0.100.0 look tidy in decimal but cannot be summarised into a single route. Align allocations to powers of two so a whole region collapses into one prefix in the routing table.
- Keep documentation examples in the reserved ranges
- RFC 5737 reserves 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 precisely so that examples cannot collide with a real network. Using a random public address in a runbook eventually points someone at a live host.
- Verify the mask on both ends before blaming routing
- When a host reaches some destinations but not others, compare its mask against the gateway's. A /24 configured where the segment is a /23 makes half the network look remote — paste both addresses into the membership check and the mismatch shows up immediately.
Subnet Calculator FAQ
How do I calculate a subnet mask from a CIDR prefix?
What prefix length is 255.255.255.0?
How do I convert an IP address to a decimal integer or hexadecimal?
INET_ATON / INET_NTOA), when filtering logs by range, and in any bitwise membership test. The binary panel of this calculator prints the network address as a decimal integer, as hexadecimal, and as a reverse-DNS in-addr.arpa name. To convert between bases by hand, use the number base converter. How do I apply the result to a Cisco or Huawei device?
ip address 192.168.1.129 255.255.255.192; Cisco ACL with the wildcard access-list 10 permit 192.168.1.128 0.0.0.63; OSPF network 192.168.1.128 0.0.0.63 area 0; Cisco ASA, which takes the subnet mask instead, access-list OUT permit ip 192.168.1.128 255.255.255.192 any; Huawei/H3C ip address 192.168.1.129 26; and Linux iproute2 ip addr add 192.168.1.129/26 dev eth0. The trap is that IOS ACLs and OSPF take the wildcard while the ASA takes the subnet mask — swapping them raises no error but matches a completely different range. Why is the usable host count two less than the total?
What is a wildcard mask and how is it different from a subnet mask?
access-list 10 permit 192.168.1.128 0.0.0.63 matches the same block as 192.168.1.128/26. Huawei and H3C documentation calls it a wildcard mask too, while inverse mask is common shorthand among engineers; both names refer to the same value here. Note that ACL wildcards may legally have non-contiguous bits (matching odd or even addresses, for instance) while subnet masks may not. How many hosts fit in a /24, /25 or /26?
Which IP ranges are private and which are public?
Can I use a /31 or /32 on a real network?
Are the addresses I type sent to a server?
Related Tools
View all tools →cURL Command Generator & Builder
Web & API
Build curl commands in your browser — set method, headers, auth, and body, get a copy-ready command instantly. Presets for Bearer, POST JSON, file upload. Free, private, no signup.
htpasswd Generator — bcrypt, Apache MD5 (apr1) & Basic Auth
Web & API
Generate htpasswd entries with bcrypt, Apache MD5 (apr1), SHA-1 & more. Get ready-to-paste Apache, nginx & Docker config. 100% in your browser — no upload.
Open Graph & Meta Tag Generator
Web & API
Generate Open Graph, Twitter Card & SEO meta tags with a live Google, Facebook & X preview. 100% free, in-browser, no signup — copy & paste the code.
Nginx Location Tester — Why That Block Wins
Web & API
See which nginx location block wins — and why every other block lost. Free location match tester for =, ^~, ~ and ~*, running entirely in your browser.
traceparent Decoder — W3C Trace Context
Web & API
Stop counting hex digits. Free online traceparent decoder — runs in your browser, nothing uploaded. Trace ID, span ID, all 8 trace-flags bits, tracestate check, Datadog/X-Ray/B3 conversion.
AES Decryption Tool — OpenSSL & CryptoJS Compatible
Security Tools
Decrypt AES online — GCM/CBC/CTR, passphrase or raw key, auto-detects OpenSSL & CryptoJS "U2FsdGVkX1" format. 100% in-browser, keys never leave the page.