Subnet calculator

Type an IP address with a prefix like /24 to get its network address, broadcast address, usable host range, netmask and wildcard mask. Check whether an address is in the block, split it into smaller subnets, or work with IPv6.

Type a block like 10.0.0.0/8, an address with a netmask like 10.1.2.3 255.255.0.0, or IPv6 like 2001:db8::/48.

Usable host addresses

254

How subnetting works

An IPv4 address is 32 bits, written as four numbers from 0 to 255. The prefix length (the number after the slash) says how many of those bits name the network. The rest name a host on that network. In 192.168.1.10/24, the first 24 bits (192.168.1) are the network and the last 8 bits (.10) are the host.

The netmask is the same thing written as an address: 24 ones followed by 8 zeros is 255.255.255.0. To get the network address, the calculator keeps the bits where the mask is 1 and sets the rest to 0. Setting the host bits to 1 instead gives the broadcast address.

A worked example

Take 10.20.30.40/19. A /19 leaves 13 host bits, so the block has 213 = 8,192 addresses.

  • The mask is 19 ones: 255.255.224.0. The third number, 224, is 11100000 in binary.
  • 30 in binary is 00011110. Keeping only the top 3 bits gives 00000000, so the network is 10.20.0.0.
  • Setting all 13 host bits gives the broadcast address, 10.20.31.255.
  • Usable hosts run from 10.20.0.1 to 10.20.31.254: 8,190 of them.

The number base converter is handy for checking the binary yourself.

Common subnet sizes

PrefixNetmaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

/31 and /32 are special cases. A /31 is a point-to-point link where both addresses are usable (RFC 3021). A /32 is one address. Neither has a broadcast address.

Splitting a network

Each extra bit of prefix halves the block. A /24 splits into two /25s, four /26s or eight /27s. Pick a size in “Split into smaller subnets” to list them, with each one’s host range and broadcast address. Large splits list the first 256 and give the total.

If you need different sizes (say one subnet for 100 hosts and three for 20), start with the biggest. Give it the first block that fits, then carve the next size out of what’s left. Each subnet must start on a multiple of its own size: a /26 can start at .0, .64, .128 or .192, never .32.

Special address ranges

RangeWhat it’s for
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918)
100.64.0.0/10Carrier-grade NAT (RFC 6598)
127.0.0.0/8Loopback: this machine
169.254.0.0/16Link-local, picked when DHCP fails
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation and examples
224.0.0.0/4Multicast

IPv6

IPv6 addresses are 128 bits, written as eight groups of four hex digits. Runs of zero groups can be shortened to :: once per address, so 2001:0db8:0000:0000:0000:0000:0000:0001 is 2001:db8::1. The calculator shows both forms, using the short form recommended by RFC 5952.

There’s no broadcast address in IPv6 and no need to subtract two: every address in the block can be used. Address counts are huge, so they’re shown exactly and as a power of 10.

Common mistakes

  • Using the network or broadcast address for a device. In a /24, .0 and .255 are taken. Type an address in “Is this address in the block?” to check.
  • Overlapping subnets. 10.0.0.0/23 already includes 10.0.1.0/24. Split from one parent block to avoid it.
  • Mixing up netmask and wildcard. Access lists want the wildcard; interface settings want the netmask. The calculator spots a wildcard typed where a netmask should be.
  • Leading zeros. Some software reads 010 as octal (8), so 192.168.010.1 may not mean what you think. Write 10.

Setting up a server? The chmod calculator explains file permissions, and the HTTP status codes list explains what your web server sends back.

Questions people ask

How many usable hosts are in a /24?
254. A /24 has 256 addresses, but the first (the network address, like 192.168.1.0) and the last (the broadcast address, like 192.168.1.255) can’t be given to devices. In general a block has 2 to the power of (32 minus the prefix) addresses, and 2 fewer usable hosts, except /31 and /32.
Why does a /31 have 2 usable hosts?
RFC 3021 lets a /31 be used for a point-to-point link between two routers. There’s only one other device on the link, so there’s no need for a network or broadcast address and both addresses are usable. Most modern routers support it. A /32 is a single address, used for loopbacks and host routes.
What’s the difference between a netmask and a wildcard mask?
They’re opposites. A netmask like 255.255.255.0 has 1s for the network part. A wildcard mask like 0.0.0.255 has 1s for the bits that can vary, and is used in Cisco access lists and OSPF. Subtract each part of the netmask from 255 to get the wildcard.
Which IP addresses are private?
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, from RFC 1918. They’re not routed on the internet, so you can use them freely at home or work. 100.64.0.0/10 is also not public: it’s for internet providers’ carrier-grade NAT.
What size IPv6 subnet should I use?
A /64 for each network, such as a LAN or VLAN. IPv6 auto-configuration (SLAAC) needs exactly 64 bits for the host part. Sites are usually given a /48 or /56, which you split into /64s: a /48 holds 65,536 of them and a /56 holds 256.
Does this tool send my addresses anywhere?
No. All the maths runs in your browser. The address is put in the page link so you can share or bookmark a result, so leave it out of anything you share if it’s sensitive.
↑↓ move↵ openesc close