StringMash.com

Subnet calculator

The network, broadcast and host range for any IPv4 subnet, with the binary shown.

15 characters
Updates as you type
The binary working is below

Show the steps
Address11000000101010000000000100001010Mask11111111111111111111111100000000Network11000000101010000000000100000000Network bits: 24Host bits: 8
  1. /24 means the first 24 bits are the network and the last 8 pick a host.
  2. The address in binary: 11000000.10101000.00000001.00001010
  3. The mask in binary: 11111111.11111111.11111111.00000000 (24 ones, then zeros)
  4. AND them, bit by bit: 11000000.10101000.00000001.00000000 = 192.168.1.0, the network.
  5. Set every host bit to 1 for the broadcast: 11000000.10101000.00000001.11111111 = 192.168.1.255.
  6. 8 host bits give 2^8 = 256 addresses. Take away the network and broadcast addresses: 254 hosts.

Using the calculator

Type an address with its prefix, like 192.168.1.10/24, or with its mask, like 192.168.1.10 255.255.255.0. The calculator gives the network address, the broadcast address, the range of usable host addresses, the subnet and wildcard masks, how many addresses there are, and whether the address is in a private or other special-purpose range.

Show the steps writes the address and mask in binary and ANDs them, the way it's done by hand, and the drawing marks which of the 32 bits are network and which are host. To split a range of addresses into CIDR blocks, use the CIDR calculator.

How subnetting works

An IPv4 address is 32 bits. The prefix says how many of them, from the left, name the network; the rest pick a host on it. In 192.168.1.10/24, the first 24 bits, 192.168.1, are the network and the last 8 are the host.

To find the network address, AND the address with the mask: every host bit becomes 0. To find the broadcast address, set every host bit to 1. With h host bits there are 2ʰ addresses, and two of them, the network and the broadcast, can't be given to a host. A /24 has 8 host bits: 256 addresses and 254 hosts.

Private ranges and the small prefixes

RFC 1918, from February 1996, set aside three blocks for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Addresses in them aren't routed on the public internet, which is why home networks are usually numbered from one. The calculator also names the other special-purpose ranges in IANA's registry, like 127.0.0.0/8 for loopback.

A /31 has only two addresses. RFC 3021, from December 2000, lets both be used as hosts on a point-to-point link, with no network or broadcast address. A /32 is a single host.

Questions

What's a wildcard mask?

The subnet mask with every bit flipped: 255.255.255.0 becomes 0.0.0.255. Router access lists use it to say which bits of an address are allowed to vary.

How many hosts in a /24?

254. The 8 host bits give 256 addresses, minus the network and broadcast addresses.

Does it work for IPv6?

Not yet. It handles IPv4 addresses, which are the ones subnetting is usually taught with.