IP Subnet Calculator
Calculate IPv4 subnet details instantly. Enter an IP + CIDR to get network address, broadcast, first/last usable host, subnet mask, wildcard mask, and host count. Free, browser-side, no signup.
- Runs in your browser
- Your data never leaves your browser
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Examples
The results below come from the calculator’s own functions.
| Input | Network / Broadcast | Mask / Wildcard | Usable range | Usable hosts |
|---|---|---|---|---|
192.168.1.77/26 | 192.168.1.64 / 192.168.1.127 | 255.255.255.192 / 0.0.0.63 | 192.168.1.65 – 192.168.1.126 | 62 |
172.31.100.5/20 | 172.31.96.0 / 172.31.111.255 | 255.255.240.0 / 0.0.15.255 | 172.31.96.1 – 172.31.111.254 | 4,094 |
203.0.113.9/31 | 203.0.113.8 / none | 255.255.255.254 / 0.0.0.1 | 203.0.113.8 – 203.0.113.9 | 2 |
198.51.100.7 with /32 selected | 198.51.100.7 / none | 255.255.255.255 / 0.0.0.0 | 198.51.100.7 – 198.51.100.7 | 1 |
The first row is the usual question when you see an address in a log: 192.168.1.77 with a /26 mask belongs to the
block that starts at .64, so 192.168.1.130 is in a different subnet and traffic between them goes through
a router. The CIDR Notation field shows the corrected form, 192.168.1.64/26, which is what most firewall and cloud
consoles expect; many of them reject 192.168.1.77/26 because host bits are set.
Copy writes the eight fields as labelled lines, ready for a ticket or a change request:
Network Address: 192.168.1.64
Broadcast Address: 192.168.1.127
Subnet Mask: 255.255.255.192
Wildcard Mask: 0.0.0.63
First Usable Host: 192.168.1.65
Last Usable Host: 192.168.1.126
Usable Hosts: 62
CIDR Notation: 192.168.1.64/26
The second row is a typical cloud subnet. The calculator counts 4,094 usable hosts, but AWS reserves the first four and the last address of every VPC subnet, and Azure reserves five as well, so only 4,091 can be assigned there. Subtract those yourself when you size a cloud subnet.
For /31 and /32 the calculator does not subtract a network and a broadcast address. A /31 is a point-to-point link with two usable addresses (RFC 3021), and a /32 is a single host, as used in route tables and allow-lists. Neither has a broadcast address, so the Broadcast Address field says None and gives the reason:
Broadcast Address: None (/31 point-to-point link, RFC 3021)
First Usable Host: 203.0.113.8
Last Usable Host: 203.0.113.9
Usable Hosts: 2
Output Fields Explained
| Field | Description |
|---|---|
| Network Address | First address of the subnet — identifies the network itself |
| Broadcast Address | Last address — sent to all hosts in the subnet; none for /31 and /32 |
| Subnet Mask | Dotted-decimal form of the prefix (e.g. 255.255.255.0) |
| Wildcard Mask | Bitwise inverse of the subnet mask |
| First Usable Host | Network address + 1; the network address itself for /31 and /32 |
| Last Usable Host | Broadcast address − 1; the last address for /31 and /32 |
| Usable Hosts | Total addresses minus 2 (network + broadcast); 2 for /31 and 1 for /32 |
| CIDR Notation | Canonical network/prefix form |
Common Subnet Reference
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /30 | 255.255.255.252 | 2 |
| /29 | 255.255.255.248 | 6 |
| /28 | 255.255.255.240 | 14 |
| /27 | 255.255.255.224 | 30 |
| /26 | 255.255.255.192 | 62 |
| /25 | 255.255.255.128 | 126 |
| /24 | 255.255.255.0 | 254 |
| /23 | 255.255.254.0 | 510 |
| /22 | 255.255.252.0 | 1,022 |
| /16 | 255.255.0.0 | 65,534 |
Errors and Limitations
- Addresses must be four decimal numbers from 0 to 255 with no leading zeros.
10.0.0.01,0x0a.0.0.1and10.1show “Invalid IPv4 address. Use four numbers from 0 to 255 separated by dots, with no leading zeros (e.g. 10.0.0.1).” This matchesinet_ptonand Node’snet.isIPv4; it avoids guessing whether010means 10 or octal 8. - Before that check, full-width digits, dots and slash (
192.168.1.77/26) and the ideographic full stop (192。168。1。77/26) that an IME may type are read as ASCII. The text in the field is left as you typed it. - The prefix must be a whole number from 0 to 32.
/33,/24xand/024show “The CIDR prefix must be a whole number from 0 to 32 (e.g. /24).” - Dotted masks are not accepted after the slash. Type
/26, or look up the prefix for a mask in the table above. - IPv4 only. IPv6 addresses are rejected as invalid.
- One subnet at a time: the tool does not split a block into smaller subnets, list every address, or check whether two ranges overlap.
Common Use Cases
- Network design and VLAN planning
- Verifying firewall and ACL rules
- Troubleshooting routing issues
- Cloud VPC and security-group configuration (AWS, GCP, Azure)
- OSPF and BGP prefix calculations
FAQ
What is a subnet?
A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a large network into smaller, more manageable segments, improving performance and security.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its associated prefix length together, e.g. 192.168.1.0/24. The number after the slash is the prefix length — the count of bits reserved for the network portion.
How is the subnet mask calculated?
The subnet mask is derived from the prefix length by setting the first N bits to 1 and the rest to 0. For /24 that gives 255.255.255.0 (24 ones followed by 8 zeros).
What is the wildcard mask?
The wildcard mask is the bitwise inverse of the subnet mask. It is used in ACLs and routing protocols (e.g. OSPF) to specify which bits of an address are significant.
How many usable hosts does a /24 have?
A /24 subnet has 256 total addresses. Two are reserved — one for the network address and one for the broadcast address — leaving 254 usable host addresses.
Which address formats does the calculator accept?
Dotted decimal as inet_pton reads it: four numbers from 0 to 255 separated by dots, digits only, with no leading zeros. 10.0.0.01, 10.0.0.1x, 0x0a.0.0.1 and 10.1 are rejected with an error, not guessed at (some parsers read 010 as octal 8). The prefix after the slash must be a whole number from 0 to 32, so /24x and /024 are rejected too. Full-width digits, dots and slash typed with an IME, and the ideographic full stop 。, are read as their ASCII forms first.
Is the address I enter sent or saved anywhere?
No. The calculation runs in your browser tab with JavaScript bit operations; the address and prefix are not sent to a server and are not saved in browser storage. The page's analytics records a usage event with the tool name and the action when you leave the address field or change the prefix, not the address itself.