Subnet Calculator

Enter an IP address with its prefix or subnet mask to get the network, broadcast, usable host range and wildcard, bit by bit. This IPv4 and IPv6 subnet calculator is also a CIDR calculator and subnet mask calculator: it splits networks, plans VLSM and applies cloud rules.

RFC 4632 and RFC 3021 arithmetic · IANA's special-purpose registries · each cloud's own documentation · runs in your browser

Type it any way you have it: CIDR, a mask or a Cisco wildcard after the address, a range with a dash, or IPv6. Drag the line between the bits to change the prefix. Nothing leaves your browser.

Private network · RFC 1918/24Class C · historic

254 usable hosts · 192.168.1.1 – 192.168.1.254

  1. 1

    The mask

    /24 is 24 ones, then 8 zeros

    mask11111111.11111111.11111111.00000000255.255.255.0
  2. 2

    Network = address AND mask

    Keep the bits where the mask has a 1

    address11000000.10101000.00000001.00000000192.168.1.0
    ANDmask11111111.11111111.11111111.00000000255.255.255.0
    network11000000.10101000.00000001.00000000192.168.1.0
  3. 3

    Broadcast = network OR wildcard

    Set every host bit to 1

    network11000000.10101000.00000001.00000000192.168.1.0
    ORwildcard00000000.00000000.00000000.111111110.0.0.255
    broadcast11000000.10101000.00000001.11111111192.168.1.255
  4. 4

    Hosts = 232 − 24 − 2 = 256 − 2 = 254

    The network and broadcast addresses can't be given to a device

    first host 192.168.1.1last host 192.168.1.254

Shortcut. The prefix ends on an octet edge: the network keeps 3 whole octets (192.168.1) and the rest are host bits.

What is a subnet and a subnet mask?

A subnet is a block of IP addresses that share the same leading bits, and the subnet mask says how many bits that is: in 192.168.1.10 with mask 255.255.255.0, the first 24 bits (192.168.1) name the network and the last 8 bits (10) name one device on it.

Every IPv4 address is 32 bits. The mask is 32 bits too: a run of ones over the network part and zeros over the host part, never mixed (RFC 1812). Devices whose addresses share the network bits reach each other directly; anything else goes through a router.

Within a subnet, the address with all host bits zero names the network itself and the one with all host bits one is its broadcast address, so a normal subnet has two addresses fewer than its size for devices (RFC 1122). A /24 holds 256 addresses and 254 hosts.

One address, two parts192.168.1.10/24

This subnet192.168.1.0/24

  • 192.168.1.1
  • 192.168.1.10
  • 192.168.1.11
  • 192.168.1.12
Reached directly
RouterThrough the router

Another subnet192.168.2.0/24

  • 192.168.2.1
  • 192.168.2.10
  • 192.168.2.11
The mask's ones cover the network part: every device whose first 24 bits are 192.168.1 is on the same subnet. Addresses in another subnet are reached through a router.
Subnet calculator: 192.168.1.10/24 with its network, broadcast, usable host range and mask, and the address in binarySubnet calculator: 192.168.1.10/24 with its network, broadcast, usable host range and mask, and the address in binaryAny notationCIDR, a subnet mask, a wildcard mask, a range or IPv6, typed the way you have it.The bitsNetwork bits and host bits side by side; drag the boundary to try another prefix.The answerNetwork, broadcast, the first and last usable host and how many there are.PlanSplit the network, fit subnets of different sizes, or apply a cloud's rules.
192.168.1.10/24 worked out: the network and host bits, the usable range and the masks. Select a number to see what each part shows.

How to subnet a network in 4 steps

Pick how many subnets or hosts you need, borrow that many bits from the host part, then step through the network in blocks of the new size: 192.168.1.0/24 split into four subnets becomes four /26 blocks of 64 addresses, 62 hosts each.

1. Count: four subnets need 2 extra network bits (2² = 4), so /24 becomes /26. For a host count instead, take the smallest block that holds it: 50 hosts need 64 addresses, a /26.

2. Block size: 2^(32 − 26) = 64 addresses per subnet, which makes the mask 255.255.255.192.

3. Step through: the networks start every 64 addresses: 192.168.1.0, .64, .128 and .192.

4. Ends: in each block the first address is the network, the last the broadcast, and the hosts are in between. So for 10.67.100.77/26 the network is 10.67.100.64, the hosts run from .65 to .126 and the broadcast is .127.

192.168.1.0/24 into four /26s64 addresses each
192.168.1.0/26.1 – .62.63
192.168.1.64/26.65 – .126.127
192.168.1.128/26.129 – .190.191
192.168.1.192/26.193 – .254.255

SubnetFirst host – Last hostBroadcast

The same method on two exam questions

10.67.100.77/264th octet · blocks of 64
06412819277
Network
10.67.100.64
First usable
10.67.100.65
Last usable
10.67.100.126
Broadcast
10.67.100.127
10.67.100.0/173rd octet · blocks of 128
0128100
Network
10.67.0.0
First usable
10.67.0.1
Last usable
10.67.127.254
Broadcast
10.67.127.255

Not the network address: 10.67.100.0/17 → 10.67.0.0/17

Borrowing 2 host bits gives four blocks of 64. For any address, the octet the prefix ends in is cut into such blocks: the address's block gives the network, the next one minus 1 the broadcast.

CIDR notation: what /24 means

CIDR notation writes a network as an address, a slash and the number of network bits: 192.168.1.0/24 means the first 24 bits are the network, the same as mask 255.255.255.0 (RFC 4632).

Each step of one bit doubles or halves the block: a /23 is two /24s (512 addresses), a /25 is half of one (128). A /16 holds 256 /24s, and a /8 holds 65,536 of them.

CIDR replaced the old classes A, B and C in 1993 (RFC 1519, now RFC 4632). Since then the mask can't be guessed from the first octet, so it is always written out; the calculator shows the old class only as history.

Each extra bit halves the blockaddresses
  1. /221,024255.255.252.04 /24s
  2. /23512255.255.254.02 /24s
  3. /24256255.255.255.01 /24
  4. /25128255.255.255.128½ of a /24
  5. /2664255.255.255.192¼ of a /24
A /22 is four /24s; a /26 is a quarter of one. Their masks: 255.255.252.0, 255.255.254.0, 255.255.255.0, 255.255.255.128 and 255.255.255.192.

Subnet mask cheat sheet: /0 to /32

Every IPv4 prefix with its subnet mask, wildcard mask, addresses and usable hosts. Select a row to work it out in the calculator.

Usable hosts are the addresses minus the network and the broadcast, except at /31, where both addresses are hosts on a point-to-point link (RFC 3021), and /32, a single host.

PrefixSubnet maskWildcardAddressesUsable hostsCompared with a /24
/00.0.0.0255.255.255.255255.255.255.2554,294,967,2964,294,967,294Every IPv4 address16,777,216 /24s
/1128.0.0.0127.255.255.255127.255.255.2552,147,483,6482,147,483,6468,388,608 /24s
/2192.0.0.063.255.255.25563.255.255.2551,073,741,8241,073,741,8224,194,304 /24s
/3224.0.0.031.255.255.25531.255.255.255536,870,912536,870,9102,097,152 /24s
/4240.0.0.015.255.255.25515.255.255.255268,435,456268,435,4541,048,576 /24s
/5248.0.0.07.255.255.2557.255.255.255134,217,728134,217,726524,288 /24s
/6252.0.0.03.255.255.2553.255.255.25567,108,86467,108,862262,144 /24s
/7254.0.0.01.255.255.2551.255.255.25533,554,43233,554,430131,072 /24s
/8255.0.0.00.255.255.2550.255.255.25516,777,21616,777,214Old class A size65,536 /24s
/9255.128.0.00.127.255.2550.127.255.2558,388,6088,388,60632,768 /24s
/10255.192.0.00.63.255.2550.63.255.2554,194,3044,194,30216,384 /24s
/11255.224.0.00.31.255.2550.31.255.2552,097,1522,097,1508,192 /24s
/12255.240.0.00.15.255.2550.15.255.2551,048,5761,048,5744,096 /24s
/13255.248.0.00.7.255.2550.7.255.255524,288524,2862,048 /24s
/14255.252.0.00.3.255.2550.3.255.255262,144262,1421,024 /24s
/15255.254.0.00.1.255.2550.1.255.255131,072131,070512 /24s
/16255.255.0.00.0.255.2550.0.255.25565,53665,534Old class B size256 /24s
/17255.255.128.00.0.127.2550.0.127.25532,76832,766128 /24s
/18255.255.192.00.0.63.2550.0.63.25516,38416,38264 /24s
/19255.255.224.00.0.31.2550.0.31.2558,1928,19032 /24s
/20255.255.240.00.0.15.2550.0.15.2554,0964,09416 /24s
/21255.255.248.00.0.7.2550.0.7.2552,0482,0468 /24s
/22255.255.252.00.0.3.2550.0.3.2551,0241,0224 /24s
/23255.255.254.00.0.1.2550.0.1.2555125102 /24s
/24255.255.255.00.0.0.2550.0.0.255256254Old class C size1 /24
/25255.255.255.1280.0.0.1270.0.0.1271281262 per /24
/26255.255.255.1920.0.0.630.0.0.6364624 per /24
/27255.255.255.2240.0.0.310.0.0.3132308 per /24
/28255.255.255.2400.0.0.150.0.0.15161416 per /24
/29255.255.255.2480.0.0.70.0.0.78632 per /24
/30255.255.255.2520.0.0.30.0.0.34264 per /24
/31255.255.255.2540.0.0.10.0.0.122Point-to-point link128 per /24
/32255.255.255.2550.0.0.00.0.0.011Single host256 per /24

Common IPv6 prefixes

PrefixTypical useAddresses/64 subnets
/32An ISP's allocation79,228,162,514,264,337,593,543,950,3362964,294,967,296
/48A site (business)1,208,925,819,614,629,174,706,17628065,536
/56A site (home)4,722,366,482,869,645,213,696272256
/64One subnet (SLAAC)18,446,744,073,709,551,6162641
/127Router-to-router link221–
/128One address120–

How many usable hosts? /30, /31 and /32

A /30 has 4 addresses and 2 usable hosts, a /31 has 2 addresses and both are usable on a point-to-point link, and a /32 is one address: a single host.

The rule 2^n − 2 holds from /0 to /30. For links between two routers, RFC 3021 allows a /31 with no network or broadcast address, which uses half the addresses of a /30. Cisco supports it on point-to-point links (Cisco).

A /32 is a host route: one address, used for loopback interfaces and single-address routes. Clouds subtract more than two addresses in every subnet, so their counts differ; see the cloud section below.

Where the addresses go/30 · /31 · /32

198.51.100.4/302 usable

.4network.5host.6host.7broadcast

198.51.100.4/312 usablepoint-to-point (RFC 3021)

.4host.5host

198.51.100.4/321 usableone host

.4host
A /30 loses half its four addresses to the network and broadcast addresses. A /31 on a link between two routers keeps both, and a /32 is a single address.

Wildcard mask: the inverse of the subnet mask

A wildcard mask is the subnet mask with every bit flipped, so 255.255.255.0 becomes 0.0.0.255: a 0 bit must match and a 1 bit is ignored. Cisco access lists and OSPF network statements take wildcard masks.

For a normal mask, the wildcard is 255.255.255.255 minus the mask: /20's 255.255.240.0 gives 0.0.15.255. In an access list, permit 10.1.0.0 0.0.255.255 matches every address from 10.1.0.0 to 10.1.255.255 (Cisco).

Type a wildcard after an address (10.1.0.0 0.0.255.255) and the calculator reads it as the matching prefix, /16.

An access list line, bit by bitpermit 10.1.0.0 0.0.255.255
  • Must match
  • Any value

Matches 10.1.0.0 to 10.1.255.255

Mask and wildcard
/8255.0.0.00.255.255.255
/16255.255.0.00.0.255.255
/20255.255.240.00.0.15.255
/24255.255.255.00.0.0.255
/27255.255.255.2240.0.0.31
In the wildcard a 0 bit must match the address and a 1 bit may be anything, so 0.0.255.255 lets the last two octets vary.

VLSM: subnets of different sizes in one network

Variable-length subnet masking (VLSM) gives each subnet only the size it needs: in one /24, a Wi-Fi network of 100 hosts gets a /25, an office of 50 a /26, servers a /27 and a router link a /30, with addresses left over.

This VLSM calculator places the largest subnet first and each next one at the following free address, so every block starts on a boundary of its own size and nothing overlaps. Routers have had to support masks of different lengths in one network since RFC 1812 (1995).

It reports how many addresses the plan uses and how many hosts it serves, lists the free blocks that remain, and names the subnet that doesn't fit when the network is too small.

One /24, four sizesbiggest first
Wi-Fi/25Office/26Servers/27
  1. Wi-Fi100 hosts192.168.1.0/25192.168.1.1 – 192.168.1.126
  2. Office50 hosts192.168.1.128/26192.168.1.129 – 192.168.1.190
  3. Servers20 hosts192.168.1.192/27192.168.1.193 – 192.168.1.222
  4. Router link2 hosts192.168.1.224/30192.168.1.225 – 192.168.1.226
  5. Free192.168.1.228/30 · 192.168.1.232/29 · 192.168.1.240/28

228 of 256 addresses used, 28 free

Placed largest first, every block starts on a boundary of its own size: the /25 at .0, the /26 at .128, the /27 at .192, the /30 at .224. What's left is three free blocks.

IPv6 subnetting: /48, /56 and /64

In IPv6 a subnet is normally a /64, and sites get a /48 (65,536 subnets) or a /56 (256 subnets) to divide. There is no broadcast address: only the Subnet-Router anycast address and the top 128 interface IDs, kept for anycast, are set aside.

A /64 is the size automatic addressing (SLAAC) needs: the last 64 bits are the device's interface ID (RFC 4291, RFC 7421). Longer prefixes are valid (RFC 7608), and a /127 is the IPv6 version of a /31 for links between routers (RFC 6164).

RIPE's best practice for ISPs is a /48 for businesses and a /48 or /56 for homes, and it strongly discourages anything longer than a /56 (RIPE-690). Subnet on 4-bit boundaries (/52, /56, /60) so each subnet is whole hex digits and reverse DNS delegates cleanly. The IPv6 Subnet Calculator plans those levels for you: sites, buildings and VLANs on whole hex digits, with a reserve for growth.

One address, four levels2001:db8:abcd:12::/64
PrefixBits to /64/64s insideAddresses
/32324,294,967,29679,228,162,514,264,337,593,543,950,336296
/481665,5361,208,925,819,614,629,174,706,176280
/5682564,722,366,482,869,645,213,696272
/640118,446,744,073,709,551,616264
Exact counts. Each hex digit is 4 bits: a /48 leaves 4 digits, 0000 to ffff, for 65,536 subnets.

Cloud subnets: why a /24 in AWS has 251 usable addresses

AWS and Azure keep 5 addresses in every subnet, Google Cloud keeps 4 and Oracle Cloud 3, so a /24 has 251 usable addresses in AWS or Azure, 252 in Google Cloud and 253 in Oracle Cloud.

AWS keeps the network address, +1 for the VPC router, +2 for DNS, +3 for future use and the last address, and allows subnets from /16 to /28 (AWS). Azure keeps the network, the gateway, two addresses for Azure DNS and the last, from /2 to /29 (Azure).

Google Cloud keeps the first two and the last two addresses of a primary range, from /4 to /29, and none in secondary ranges (Google Cloud). Oracle Cloud keeps the network, the gateway and the last address, from /16 to /30 (Oracle). Choose a cloud in the calculator to apply its rules to a split or a VLSM plan.

The addresses each cloud keeps in 10.0.1.0/24
  • AWS251 usable

    .0network.1router.2DNS.3future250 more.254.255last
  • Azure251 usable

    .0network.1gateway.2DNS.3DNS250 more.254.255last
  • Google Cloud252 usable

    .0network.1gateway.2.3250 more.254future.255last
  • Oracle Cloud253 usable

    .0network.1gateway.2.3250 more.254.255last
  • Network address
  • Router or gateway
  • DNS
  • Future use
  • Last address
Every cloud keeps the network address, the gateway and the last address; AWS and Azure add two more at the start, Google Cloud the second-to-last.

Private and special IP ranges

Private networks use 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918); internet providers' carrier-grade NAT uses 100.64.0.0/10, and other blocks are kept for loopback, link-local, documentation, benchmarking and multicast.

The calculator checks the whole block against IANA's special-purpose registries (IPv4, IPv6), not only its first address. 10.0.0.0/7 is half private and half public, and 172.0.0.0/11 includes the private 172.16.0.0/12, so the calculator says what each one contains.

172.16.0.0/12 runs to 172.31.255.255, not only 172.16.x.x. 100.64.0.0/10 is not a private range like the others: it is meant only for the link between a provider's NAT and its customers (RFC 6598).

The IPv4 address spacespecial-purpose blocks
  • Private
  • Carrier-grade NAT
  • Loopback and link-local
  • Documentation and benchmarking
  • Multicast
  • Reserved
  • 0.0.0.0/8This network16,777,216 addresses
  • 10.0.0.0/8Private16,777,216 addresses
  • 100.64.0.0/10Carrier-grade NAT4,194,304 addresses
  • 127.0.0.0/8Loopback16,777,216 addresses
  • 169.254.0.0/16Link-local65,536 addresses
  • 172.16.0.0/12Private1,048,576 addresses
  • 192.0.2.0/24Documentation256 addresses
  • 192.168.0.0/16Private65,536 addresses
  • 198.18.0.0/15Benchmarking131,072 addresses
  • 198.51.100.0/24Documentation256 addresses
  • 203.0.113.0/24Documentation256 addresses
  • 224.0.0.0/4Multicast268,435,456 addresses
  • 240.0.0.0/4Reserved268,435,456 addresses
Each block drawn at its place in the 4,294,967,296 IPv4 addresses. Small blocks are drawn wider than their share so they can be seen.

Subnet calculator: questions and answers

How many usable hosts are in a /24?

254. A /24 holds 256 addresses: 2 to the power of the 8 host bits. The first, such as 192.168.1.0, names the network and the last, 192.168.1.255, is the broadcast address, so 254 addresses are left for devices. In AWS or Azure a /24 has 251 usable addresses, because those clouds keep 5 in every subnet.

What is the subnet mask for /27?

255.255.255.224. A /27 has 27 network bits, so the mask is 27 ones followed by 5 zeros, which reads 224 in the last octet. The block holds 32 addresses with 30 usable hosts, and its wildcard mask is 0.0.0.31. The cheat sheet on this page lists the mask for every prefix from /0 to /32.

How do I find the subnet prefix length from a subnet mask?

Count the one bits in the mask. 255.255.255.0 is 24 ones, so its prefix length is /24; 255.255.240.0 is 8 + 8 + 4 ones, so /20. Type the address and mask together, such as 10.1.2.3 255.255.240.0, and the calculator converts it. A mask whose ones have gaps, like 255.0.255.0, isn't valid.

How do I find the network address from an IP address and mask?

Combine the address and the mask bit by bit with AND: wherever the mask has a 1 the address bit stays, wherever it has a 0 the bit becomes 0. For 10.67.100.77/26 that gives 10.67.100.64. The broadcast address sets the same host bits to 1 instead: 10.67.100.127. The calculator shows both steps in binary.

Why does a /31 have two usable hosts?

Because RFC 3021 lets a /31 drop the network and broadcast addresses on a point-to-point link, where only two devices exist and a broadcast can only reach the other end. Both addresses become hosts, so a link between two routers uses 2 addresses instead of the 4 of a /30. Use /31s only on such links.

Can I use subnet zero and the all-ones subnet?

Yes. Early subnetting advice (RFC 950, 1985) said those two subnets should not be used, but RFC 1878 calls that practice obsolete, and Cisco IOS has allowed subnet zero by default since release 12.0. Splitting a /24 into four /26s therefore gives four usable subnets, 192.168.1.0/26 included, not two.

What's the difference between a subnet mask and a wildcard mask?

They are inverses. In a subnet mask the ones mark the network bits, as in 255.255.255.0; in a wildcard mask the ones mark the bits to ignore, as in 0.0.0.255. Routers use subnet masks on interfaces, while Cisco access lists and OSPF network statements take wildcard masks. The calculator shows both for every block.

How many /24 subnets fit in a /16?

256. Each extra bit doubles the number of subnets, and going from /16 to /24 adds 8 bits: 2 to the power of 8 is 256. Each /24 has 254 usable hosts, so the /16 gives 65,024 hosts as /24s, or 65,534 as one network. Use Split to list the 256 networks.

What is a /64 in IPv6, and how many are in a /48?

A /64 is the standard IPv6 subnet: 64 bits of network prefix and a 64-bit interface ID, the size automatic addressing (SLAAC) needs. It holds 18,446,744,073,709,551,616 addresses. A /48, the usual allocation for a business site, holds 65,536 /64 subnets, and a /56 holds 256.

Is what I type sent anywhere?

No. The calculator runs entirely in your browser: addresses, masks and plans are worked out on your device and never sent to us or anyone else. A link you copy carries the network in its address so it opens the same result, so share it only where you'd share the network itself.

Missing something?Suggest a feature or a new tool