CIDR / Subnet Calculator
A CIDR and IP subnet calculator: enter an IPv4 address in CIDR notation to get its network and broadcast address, subnet and wildcard masks, usable host range and address count.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing, RFC 4632) writes an IPv4 network as an address, a slash and a prefix length: the number of leading bits shared by every address in the block. The remaining bits number the hosts, so a prefix of n gives 232−n addresses. 192.168.1.0/24 fixes the first 24 bits and leaves 8, which is 256 addresses from 192.168.1.0 to 192.168.1.255.
CIDR replaced the old class A, B and C networks, which allowed only /8, /16 and /24 boundaries. Any prefix from /0 to /32 is valid, which is how cloud VPCs, firewall rules and routing tables describe address ranges today.
How to use the subnet calculator
- Type an IPv4 address with a prefix into the CIDR field, such as
10.0.12.34/20. Any address inside the network works; it does not have to be the network address. - Press Enter or click Calculate. Results do not update while you type.
- Read the eight rows of results. The page opens with
192.168.1.0/24already calculated.
Each octet must be a plain decimal number from 0 to 255, without leading zeros, and the prefix must be 0 to 32. Anything else clears the results and shows an error.
What each result means
- Network Address — your address with every host bit set to 0. It names the subnet.
- Broadcast Address — every host bit set to 1; the last address in the block.
- Subnet Mask — the prefix written as an address: /20 is
255.255.240.0. - Wildcard Mask — the mask inverted (
0.0.15.255for /20), the form used in Cisco access lists and OSPF network statements. - First Usable Host and Last Usable Host — the addresses just inside the network and broadcast addresses.
- Total Addresses and Usable Hosts — the block size, and that size minus two. Numbers use your browser’s digit grouping, such as 4,096.
/31 and /32 networks
A /31 has only two addresses. RFC 3021 allows both to be used on point-to-point links, with no network or broadcast address, so the calculator reports 2 usable hosts and lists both as first and last host. The Broadcast Address row then reads None. A /32 is a single host: network, broadcast, first and last host are all the same address, which is how firewall rules and routing tables name one machine.
Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
“Enter an address in CIDR form” for 10.0.0.0 255.255.255.0 | The calculator takes a prefix length, not a dotted mask. | Count the 1 bits in the mask: 255.255.255.0 is /24, 255.255.255.192 is /26. |
| “Invalid IPv4 address or prefix length.” | An octet above 255, a prefix above 32, an IPv6 address, or an octet with a leading zero such as 010. | Correct the value. Leading zeros are rejected because some software reads them as octal. |
| Network Address differs from what you typed | Your address had host bits set, so it is a host inside the network. | Use the Network Address shown where a network is expected; some systems reject a block like 10.1.2.3/8. |
| Your cloud console shows fewer free addresses | Providers reserve extra addresses for routers and DNS. | Subtract them: AWS and Azure reserve five per subnet, Google Cloud four. |
| Two networks cannot be peered or routed over a VPN | Their ranges overlap. | Check each block’s first and last address; pick ranges that do not share any. |
Worked examples
Each row was calculated with this tool.
| Input | Network – Broadcast | Mask | Usable hosts | Note |
|---|---|---|---|---|
192.168.1.77/26 | 192.168.1.64 – 192.168.1.127 | 255.255.255.192 | 62 | Host address resolved to its /26 |
10.0.12.34/20 | 10.0.0.0 – 10.0.15.255 | 255.255.240.0 | 4,094 | A common cloud subnet size |
203.0.113.9/29 | 203.0.113.8 – 203.0.113.15 | 255.255.255.248 | 6 | A small public block (documentation range) |
172.16.5.4/12 | 172.16.0.0 – 172.31.255.255 | 255.240.0.0 | 1,048,574 | The whole RFC 1918 172.16/12 range |
10.0.0.0/31 | 10.0.0.0 – 10.0.0.1 | 255.255.255.254 | 2 | Point-to-point link |
10.0.0.5/32 | 10.0.0.5 – 10.0.0.5 | 255.255.255.255 | 1 | Single host |
Splitting a network
Each extra prefix bit halves the block. A /24 splits into two /25s, four /26s or eight /27s. For 10.0.0.0/24 the four /26 subnets start at 10.0.0.0, 10.0.0.64, 10.0.0.128 and 10.0.0.192, each with 62 usable hosts. Enter any of them to confirm its range.
Private and special ranges
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598), and 203.0.113.0/24 is one of the blocks set aside for documentation, which is why it appears in examples.
Frequently asked questions
How many usable hosts are in a /26, /27 or /28?
A /26 has 64 addresses and 62 usable hosts, a /27 has 32 and 30, and a /28 has 16 and 14. The rule is 2(32 − prefix) minus 2, except for /31 and /32.
What is the difference between a subnet mask and a wildcard mask?
They are bitwise opposites. A subnet mask marks network bits with 1; a wildcard mask marks the bits that may vary with 1. Cisco ACLs use wildcards, so /24 becomes 0.0.0.255.
Can I enter a subnet mask instead of a prefix?
No. Convert the mask first: each 255 is 8 bits, and the last non-zero octet adds 1 (128), 2 (192), 3 (224), 4 (240), 5 (248), 6 (252) or 7 (254).
Does it support IPv6?
No, IPv4 only; an IPv6 address produces an error. IPv6 subnets for ordinary LANs are normally /64, far too many addresses to count hosts in the same way.
Why does the calculator reject 010.0.0.1?
Classic C functions such as inet_aton read a leading zero as octal, so 010 means 8 there but 10 elsewhere. Rejecting the form avoids silently picking one meaning.
Is the address I enter sent anywhere?
No. The calculation is bit arithmetic in your browser, and nothing is uploaded, so internal network plans stay on your machine.