Subnet Calculator

Enter an IP address with a prefix (CIDR) or a mask to get the network, host range and number of hosts. IPv4 and IPv6.

Try: 10.0.0.0/8 192.168.1.130/26 172.16.5.4 255.255.240.0 2001:db8::/48

What is a subnet calculator?

A subnet calculator takes an IP address and a prefix length, such as 192.168.1.130/26, and works out the network it belongs to: the network address, the first and last usable host, the broadcast address, the subnet mask and how many devices fit in it. It saves you from doing binary arithmetic by hand when you plan a network, configure a router or firewall, or read someone else's configuration.

This calculator handles IPv4 and IPv6, accepts both CIDR prefixes and dotted masks, and can split a network into smaller subnets. It runs entirely in your browser, so it is instant and nothing you type is sent anywhere.

How to use it

  1. Type an address with a prefix (10.20.0.0/16), with a mask (10.20.0.0 255.255.0.0) or alone (IPv4 defaults to /24, IPv6 to /64).
  2. The results update as you type: network, host range, mask, wildcard, number of hosts and address type.
  3. Choose a longer prefix under Split into subnets to list the smaller networks, for example a /24 split into four /26.
  4. The address bar keeps your input (?cidr=), so you can bookmark or share the result.

CIDR, masks and hosts

An IPv4 address has 32 bits. The prefix length says how many of them identify the network; the rest identify hosts inside it. A /24 leaves 8 bits for hosts, which gives 28 = 256 addresses. The subnet mask writes the same thing as an address: 24 bits set to 1 followed by 8 bits set to 0, which is 255.255.255.0.

In every IPv4 subnet larger than /31, the first address is the network address and the last is the broadcast address, so a subnet has two usable hosts fewer than addresses. Point-to-point links can use a /31 with both addresses usable (RFC 3021), and a /32 describes a single host.

IPv4 subnet cheat sheet

Prefix Mask Addresses Usable hosts
/8 255.0.0.0 16,777,216 16,777,214
/9 255.128.0.0 8,388,608 8,388,606
/10 255.192.0.0 4,194,304 4,194,302
/11 255.224.0.0 2,097,152 2,097,150
/12 255.240.0.0 1,048,576 1,048,574
/13 255.248.0.0 524,288 524,286
/14 255.252.0.0 262,144 262,142
/15 255.254.0.0 131,072 131,070
/16 255.255.0.0 65,536 65,534
/17 255.255.128.0 32,768 32,766
/18 255.255.192.0 16,384 16,382
/19 255.255.224.0 8,192 8,190
/20 255.255.240.0 4,096 4,094
/21 255.255.248.0 2,048 2,046
/22 255.255.252.0 1,024 1,022
/23 255.255.254.0 512 510
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2
/32 255.255.255.255 1 1

Private and special ranges

  • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16: private networks (RFC 1918), not routed on the internet.
  • 100.64.0.0/10: carrier-grade NAT, used inside ISP networks.
  • 127.0.0.0/8: loopback; 169.254.0.0/16: link-local, assigned when DHCP fails.
  • fc00::/7: IPv6 unique local addresses; fe80::/10: IPv6 link-local.

The calculator labels each address with its type, so you can spot a private range at a glance.

IPv6 subnetting

IPv6 addresses have 128 bits, so the numbers become astronomical: a single /64 holds more than 18 quintillion addresses. That is why IPv6 is planned by number of networks, not number of hosts. The rule of thumb: every LAN is a /64, a site gets a /48 or /56, and you split it into /64 networks. A /48 gives 65,536 of them; a /56 gives 256. There is no broadcast address in IPv6, so every address in the range is usable.

Next steps

Found a public IP in your range? See who owns it and where it is with IP Lookup, check its name with Reverse DNS, or find your own address on the What is my IP page.

Frequently asked questions

What does /24 mean?

It is the prefix length in CIDR notation: the first 24 bits of the address identify the network and the remaining 8 bits identify hosts. A /24 has 256 addresses (254 usable), the same as the mask 255.255.255.0.

Why are there two fewer usable hosts than addresses?

In IPv4 the first address of a subnet is the network address and the last one is the broadcast address; neither can be assigned to a device. The exceptions are /31 (point-to-point links, both addresses usable, RFC 3021) and /32 (a single host).

How do I convert a subnet mask to CIDR?

Count the 1 bits of the mask. 255.255.255.0 has 24, so it is /24; 255.255.240.0 has 20, so /20. You can type either form in the calculator: 10.0.0.0/20 or 10.0.0.0 255.255.240.0.

What is a wildcard mask?

The inverse of the subnet mask: 0.0.0.255 for a /24. Cisco access lists and OSPF use it to say which bits must match (0) and which can be anything (1).

How big should an IPv6 subnet be?

A single LAN uses a /64: features like SLAAC need it. ISPs usually give customers a /56 or /48, which you split into /64 networks. Use the "Split into subnets" section to list them.

Is my data sent anywhere?

No. The calculator runs entirely in your browser; the address you type never leaves your device.

Related tools

Last updated: