Subnet Calculator (IP / CIDR)
Type an IP address and mask to get the network, broadcast, usable host range and binary view, then split it into subnets, check an address or work with IPv6.
You can also type 192.168.1.10/24.
One subnet per line or comma: a name and the hosts it needs. The biggest is placed first.
Separate with commas, spaces or new lines. An address without /n counts as one host (/32).
Short or full form. You can add the prefix, like 2001:db8::/32.
Subnets
How your subnet is worked out
Network = IP AND mask. Usable hosts = 2^host bits − 2.
- 1
IP in binary
192.168.1.10 =11000000.10101000.00000001.00001010
- 2
The /24 mask
24 ones, 8 zeros= 255.255.255.0
- 3
Network = IP AND mask
Keep the first 24 bits,set the rest to 0= 192.168.1.0
- 4
Usable hosts
2^8 − 2 = 254192.168.1.1 –192.168.1.254Broadcast 192.168.1.255
Read more: the formula, a worked example, private ranges and a mask table
An IPv4 address is 32 bits, written as four numbers from 0 to 255. The mask says how many of those bits, counted from the left, name the network; the rest number the hosts (devices) inside it. Writing /24 after an address (CIDR notation) means the first 24 bits are the network.
The formula
network address = IP AND mask
broadcast address = network OR wildcard
wildcard = 255.255.255.255 − mask
addresses = 2^(32 − prefix)
usable hosts = 2^(32 − prefix) − 2 (a /31 has 2, a /32 has 1)
first host = network + 1, last host = broadcast − 1
subnets from borrowing b bits = 2^b
Worked example
Take 192.168.1.10/24. In binary the address is 11000000.10101000.00000001.00001010 and the /24 mask is 24 ones followed by 8 zeros, which is 255.255.255.0. Keeping the first 24 bits and zeroing the last 8 gives the network 192.168.1.0. Setting the last 8 bits to 1 gives the broadcast 192.168.1.255. There are 2^8 = 256 addresses, and 256 − 2 = 254 usable hosts, from 192.168.1.1 to 192.168.1.254. The wildcard mask is 255.255.255.255 − 255.255.255.0 = 0.0.0.255. The first octet, 192, makes it a historic class C address, and it sits in 192.168.0.0/16, a private range (RFC 1918).
Splitting a network
To cut 192.168.1.0/24 into 4 subnets, borrow 2 host bits, because 2^2 = 4. The new prefix is /24 + 2 = /26, each subnet has 2^(32 − 26) = 64 addresses and 62 usable hosts, and they start at .0, .64, .128 and .192. If you need a number that isn't a power of two, round up: 5 subnets need 3 bits, which makes 8.
By hosts it works the other way: 50 hosts plus the network and broadcast addresses need 6 host bits (2^6 = 64), so each subnet is a /26 and a /24 holds 2^(26 − 24) = 4 of them.
VLSM: subnets of different sizes
VLSM sizes each subnet for its own hosts. Sort the needs from biggest to smallest, give each the smallest block that fits, and place them one after another, each starting on a multiple of its own size. In 192.168.1.0/24, needs of 50, 20, 10 and 2 hosts become 192.168.1.0/26, 192.168.1.64/27, 192.168.1.96/28 and 192.168.1.112/30. That uses 116 addresses and leaves 140 free as 192.168.1.116/30, 192.168.1.120/29 and 192.168.1.128/25.
Summarising (supernetting)
A summary route is the smallest single block that covers several networks. Write the lowest and highest addresses in binary and count how many leading bits they share. 192.168.0.0/24 to 192.168.3.0/24 share the first 22 bits, so they summarise to 192.168.0.0/22 with no extra addresses. If there are gaps, the summary also covers addresses you don't own, so the calculator also lists the exact blocks that cover only your networks.
Special IPv4 ranges
| Block | What it is | Defined in |
|---|---|---|
| 0.0.0.0/8 | "This network" – not a real destination | RFC 1122 |
| 10.0.0.0/8 | Private network | RFC 1918 |
| 100.64.0.0/10 | Shared address space for carrier-grade NAT (CGNAT) | RFC 6598 |
| 127.0.0.0/8 | Loopback – this computer | RFC 1122 |
| 169.254.0.0/16 | Link-local – self-assigned when there is no DHCP | RFC 3927 |
| 172.16.0.0/12 | Private network | RFC 1918 |
| 192.0.0.0/24 | IETF protocol assignments | RFC 6890 |
| 192.0.2.0/24 | Documentation and examples (TEST-NET-1) | RFC 5737 |
| 192.88.99.0/24 | Old 6to4 relay anycast (deprecated) | RFC 7526 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 198.18.0.0/15 | Network benchmark testing | RFC 2544 |
| 198.51.100.0/24 | Documentation and examples (TEST-NET-2) | RFC 5737 |
| 203.0.113.0/24 | Documentation and examples (TEST-NET-3) | RFC 5737 |
| 224.0.0.0/4 | Multicast (one-to-many) | RFC 5771 |
| 240.0.0.0/4 | Reserved for future use | RFC 1112 |
| 255.255.255.255/32 | Limited broadcast | RFC 919 |
Every address outside these blocks is a public internet address.
Classes (historic)
Before CIDR arrived in 1993 (RFC 1519), addresses were split into classes by the first octet: A is 0–127 (default /8), B is 128–191 (/16), C is 192–223 (/24), D is 224–239 (multicast) and E is 240–255 (reserved). Routing no longer uses classes, but they still come up in exams and older kit, so the calculator shows the class for reference.
Subnet mask table
| Prefix | 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 |
IPv6 in short
An IPv6 address is 128 bits, written as 8 groups of 4 hex digits. The short form (RFC 5952) drops leading zeros in each group and replaces the longest run of all-zero groups with ::, once. So 2001:0db8:85a3:0000:0000:8a2e:0370:7334 becomes 2001:db8:85a3::8a2e:370:7334. A normal IPv6 network is a /64; sites often get a /48 or /56, which hold 2^(64 − 48) = 65,536 or 2^(64 − 56) = 256 of them.
| Block | What it is | Defined in |
|---|---|---|
| ::/128 | Unspecified address | RFC 4291 |
| ::1/128 | Loopback – this computer | RFC 4291 |
| ::ffff:0:0/96 | IPv4-mapped address | RFC 4291 |
| 64:ff9b::/96 | NAT64 well-known prefix | RFC 6052 |
| 100::/64 | Discard-only | RFC 6666 |
| 2000::/3 | Global unicast – public internet | RFC 4291 |
| 2001::/32 | Teredo tunnelling | RFC 4380 |
| 2001:db8::/32 | Documentation and examples | RFC 3849 |
| 2002::/16 | 6to4 | RFC 3056 |
| 3fff::/20 | Documentation and examples | RFC 9637 |
| fc00::/7 | Unique local address (private) | RFC 4193 |
| fe80::/10 | Link-local | RFC 4291 |
| ff00::/8 | Multicast | RFC 4291 |
Ranges follow the IANA special-purpose address registries (RFC 6890) and the RFCs listed. The calculator works entirely in your browser; nothing you type is sent anywhere.
Common questions
How do I find the network and broadcast address?
Write the IP address and the mask in binary and keep only the bits where the mask has a 1: that is the network address. Set all the host bits (where the mask has a 0) to 1 and you get the broadcast address. For 192.168.1.10/24 the network is 192.168.1.0 and the broadcast is 192.168.1.255.
How many usable hosts are in a /24?
A /24 leaves 8 host bits, so it has 2^8 = 256 addresses. Two are taken by the network and broadcast addresses, leaving 254 usable hosts (192.168.1.1 to 192.168.1.254). In general usable hosts = 2^(32 − prefix) − 2. A /31 is the exception: it has 2 usable addresses for point-to-point links (RFC 3021), and a /32 is a single host.
What is the difference between a subnet mask and a wildcard mask?
They are opposites. A subnet mask has 1s for the network bits, like 255.255.255.0 for a /24. A wildcard mask flips every bit, so the same network is 0.0.0.255. Routers and firewalls (for example in access lists and OSPF) often ask for the wildcard. Each octet of the wildcard is 255 minus the same octet of the mask.
Which IP addresses are private?
RFC 1918 sets aside three private blocks for home and office networks: 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. Internet providers also use 100.64.0.0/10 for carrier-grade NAT (RFC 6598). These addresses are not reachable from the public internet; everything outside the special blocks is public.
What is VLSM?
Variable Length Subnet Masking means cutting one network into subnets of different sizes instead of equal ones. You size each subnet for the hosts it needs, place the biggest first, and keep the rest free. For 192.168.1.0/24, subnets for 50, 20, 10 and 2 hosts become a /26, /27, /28 and /30, using 116 addresses and leaving 140 free.
How many /64 subnets are in an IPv6 /48?
Each bit between the two prefixes doubles the count, so a /48 holds 2^(64 − 48) = 65,536 networks of size /64. A /56 holds 2^(64 − 56) = 256. Every /64 is one normal IPv6 network (LAN) with 2^64 addresses, so IPv6 is planned by counting subnets rather than hosts.
Related calculators
Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.