CIDR Calculator & Subnet VLSM Visualizer
CIDR, netmask and host range plus VLSM subnet visualizer
CIDR, netmask and host range plus VLSM subnet visualizer
Enter an IP address and prefix length (or netmask) — everything else updates automatically.
Results
The input is invalid, so the results below are the last valid ones.
Binary view
| IP address | |
|---|---|
| Netmask | |
| Network | |
Subnet splitting
Increase the new prefix length to split the current network into equal-size subnets.
| # | Network | Broadcast | Host range | Usable hosts |
|---|
Loading…
Working…
0.0
It hasn't frozen — the result will appear when the calculation finishes.
About CIDR Calculator & Subnet VLSM Visualizer
This tool takes an IPv4 address with a prefix length (or a netmask) and works out the network address, broadcast, usable host range and wildcard mask, and can split a network into equal smaller subnets in a table. The Subnet Visualizer tab places several subnets of different sizes inside one parent network using VLSM and draws a bar showing which parts of the address space are used and which are free.
Every result comes from treating the address as a single 32-bit integer and doing bitwise AND and OR. Below, the arithmetic is worked through once by hand, followed by the /31 and /32 exceptions, the private ranges, and why IPv6 networks rarely need this kind of calculation.
Working a /26 by hand
Take 192.168.10.77/26. A /26 means the first 26 bits are the network and the last 6 bits are the host, so each block is 2^6 = 64 addresses. The netmask has 26 one-bits, 255.255.255.192, and blocks in the last octet start at 0, 64, 128 and 192.
77 lies between 64 and 128, so the network address is 192.168.10.64 and the broadcast, the last address before the next block, is 192.168.10.127. Remove those two and .65 through .126 remain: 62 usable host addresses. In general, usable hosts = 2^(32 − prefix) − 2. The wildcard mask (0.0.0.63) is the netmask inverted; Cisco ACLs and OSPF network statements ask for it in that form.
A quick mental shortcut: 256 minus the last non-zero netmask octet gives the block size. 255.255.255.224 means blocks of 32; 255.255.255.240 means blocks of 16.
/31 and /32 play by different rules
The "minus two" is there because the network and broadcast addresses cannot be assigned to hosts. Applied blindly, a /31 would have 2 − 2 = 0 usable addresses. RFC 3021 changed that for point-to-point links: with only two routers on a link, a broadcast address is pointless, so both addresses of a /31 may be used. Compared with the older habit of giving every router link a /30 (four addresses, two usable), it halves the address cost.
A /32 is a single address, used for loopback interfaces and host routes. The tool reports two usable addresses for a /31 (both the first and last) and one for a /32. Do not build an ordinary LAN on a /31, though; not every device and operating system handles a subnet without a broadcast address.
Private ranges (RFC 1918) and a common slip
RFC 1918 reserves three IPv4 blocks for private networks. They are not routed on the public internet and anyone may use them internally.
- 10.0.0.0/8 — 10.0.0.0 to 10.255.255.255 (about 16.8 million addresses)
- 172.16.0.0/12 — 172.16.0.0 to 172.31.255.255. 172.32.x.x is public, so "anything starting with 172 is private" is wrong.
- 192.168.0.0/16 — 192.168.0.0 to 192.168.255.255, the range most home routers hand out.
Splitting into equal subnets
Lengthening the prefix by n bits splits a network into 2^n subnets. /24 to /26 borrows two bits and yields four; /27 yields eight. If you need six subnets, round up to the next power of two, eight, which means /27. The tool does the same rounding when you enter a desired count, and lists at most 4,096 subnets at once to keep the table usable.
Splitting costs addresses. Four /26s give 4 × 62 = 248 usable hosts, six fewer than the 254 of the original /24, because every subnet spends two addresses on its own network and broadcast.
Subnet Visualizer mode: mixed sizes with VLSM
Real networks rarely want equal pieces. The sales floor might need 100 hosts and the server room 20; carving a /24 into four equal /26s leaves sales short and the server room with room to spare. Variable-length subnet masking picks, for each request, the smallest block that fits, then places blocks from largest to smallest. Order matters because a block can only start at a multiple of its own size (a /26 at .0, .64, .128 or .192), so placing small blocks first tends to leave alignment gaps.
The Visualizer sorts requests largest-first by default; switch that off to place them in the order you typed. A request that does not fit in the parent network is flagged while the others are still shown. Count the gateway as a host: 30 PCs plus a router interface is 31.
In IPv6, /64 is the standard LAN
The tool is IPv4-only, and IPv6 networks seldom need host-count arithmetic anyway. RFC 4291 fixes the interface identifier at 64 bits for most unicast addresses, and stateless address autoconfiguration (SLAAC) assumes a /64 per link, so a LAN simply gets a /64. That single subnet holds 2^64 addresses, which removes the IPv4 instinct to squeeze subnets smaller to save space. For router-to-router links, RFC 6164 recommends /127, the IPv6 counterpart of the IPv4 /31.
Worked examples
A /26 at a glance
- Input
192.168.10.77/26- Output
Network 192.168.10.64 · Broadcast 192.168.10.127 · Hosts .65–.126 (62) · Netmask 255.255.255.192 · Wildcard 0.0.0.63
Block size 64; 77 falls in the 64–127 block.
Point-to-point /31
- Input
10.0.0.0/31- Output
2 usable: 10.0.0.0 and 10.0.0.1
Per RFC 3021, no separate network or broadcast address.
Splitting a /24 into /26s
- Input
10.0.0.0/24 → /26- Output
10.0.0.0/26, 10.0.0.64/26, 10.0.0.128/26, 10.0.0.192/26 (62 hosts each)
Two borrowed bits give four subnets and 248 usable hosts in total.
VLSM placement
- Input
Parent 192.168.1.0/24; requests: Sales 100, Dev 50, Servers 20- Output
Sales 192.168.1.0/25 (126) · Dev 192.168.1.128/26 (62) · Servers 192.168.1.192/27 (30) · Free 192.168.1.224–255 (32 addresses)
The smallest block holding 100 hosts is a /25. Placing largest first packs them with no gaps and leaves one /27 spare.
How to use it
- Enter CIDR notation (192.168.1.10/24) or an address plus netmask.
- Read the network, broadcast and host range; enter a new prefix or a count to split it.
- For subnets of different sizes, open the Subnet Visualizer tab and list the hosts each one needs.
Frequently asked questions
How many usable hosts are in a /24?
254: 256 addresses minus the network and broadcast. Your gateway takes one of those 254.
Why does a /31 have two usable addresses?
RFC 3021 lets point-to-point links use both addresses, since they need no broadcast.
Is 172.20.0.1 a private address?
Yes. 172.16.0.0/12 covers 172.16.0.0 to 172.31.255.255; 172.32 and above are public.
When do I need a wildcard mask?
It is the inverted netmask, used in Cisco ACLs and OSPF network statements. For a /26 it is 0.0.0.63.
Does the tool handle IPv6?
No, it is IPv4-only. IPv6 LANs are normally a fixed /64, so host counting is rarely needed.
Notes
In VLSM mode the subnet type defaults to LAN (minimum /30), so even a request for 1 or 2 hosts gets a /30. For router-to-router links or loopbacks, switch to Point-to-point (allow /31 and /32); then 2 hosts get a /31 and 1 host a /32. For an ordinary LAN that also needs a gateway, count the gateway in the host number.
Sources
- RFC 1918 – Address Allocation for Private Internets
- RFC 3021 – Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 4632 – Classless Inter-domain Routing (CIDR)
- RFC 4291 – IP Version 6 Addressing Architecture
- RFC 6164 – Using 127-Bit IPv6 Prefixes on Inter-Router Links
Last reviewed: