TXT · Text & Data tools

IP Subnet Calculator

Address or CIDR

Accepts a.b.c.d/nn, an address followed by a dotted mask, a bare host address, or any IPv6 form.

Network
192.168.1.0/24
Netmask
255.255.255.0
Broadcast
192.168.1.255
Usable range
192.168.1.1 - 192.168.1.254
Usable hosts
254
Wildcard
0.0.0.255
Result
IPv4family/24prefix254usable hosts

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Subnet arithmetic for IPv4 and IPv6

Enter a CIDR block and read off its network address, netmask, wildcard mask, broadcast, usable range and host count. The same field accepts an IPv4 address with a dotted mask, a bare host address, or an IPv6 prefix. Every mode works on both address families, and IPv6 counts are shown as exact integers rather than rounded floats.

Four modes

Subnet describes one block. For IPv4 the result includes the mask in dotted-decimal and binary, the address class, whether the range is private, loopback, link-local or public, and the reverse DNS zone (0.10.in-addr.arpa. for 10.0.0.0/22). For IPv6 it shows the compressed and expanded forms, the first and last address, how many /64 networks fit inside, and the ip6.arpa. zone.

Split divides a block into equal children. Give it 10.0.0.0/22 and a new prefix of /24 and it lists 10.0.0.0/24 through 10.0.3.0/24, each with its usable range and 254 hosts. Splitting a /48 into /64s produces 65,536 rows, so the list is capped at 4,096 and the footer says how many were left out.

Range to CIDR takes a first and last address and returns the fewest blocks that cover them exactly. The order of the two addresses does not matter.

Contains compares two blocks, or a block and a single address. It reports whether A contains B, whether B contains A, whether they overlap at all, and the shared range when they do. Use it before adding a route or a firewall rule to see whether a new prefix collides with one already in the table.

Example: 10.0.0.0/22

A /22 leaves 10 host bits, so the block holds 2^10 = 1,024 addresses. The netmask is 255.255.252.0 and the wildcard 0.0.3.255. The network address is 10.0.0.0, the broadcast is 10.0.3.255, and the usable range runs from 10.0.0.1 to 10.0.3.254: 1,022 hosts. Split it at /24 and you get four blocks of 254 hosts each, which is the usual way to carve a campus allocation into per-floor networks.

How the mask works

A prefix length counts the leading one bits of the mask. /22 is 22 ones followed by 10 zeros, or 11111111.11111111.11111100.00000000. ANDing an address with the mask zeroes the host bits and leaves the network address; ORing the network with the wildcard sets every host bit and gives the last address in the block. The calculator does this with BigInt, so 128-bit IPv6 values are exact.

/31 and /32

A /30 is the classic point-to-point size with 2 usable hosts, but it wastes half the block on the network and broadcast addresses. RFC 3021 allows /31 on point-to-point links, where both addresses are assigned and there is no broadcast. The calculator reports 2 usable hosts for a /31 and 1 for a /32, and marks the broadcast as not applicable for both.

IPv6 differences

IPv6 has no broadcast address and no address class. The standard assignment to a LAN is a /64, which leaves 64 bits for interface identifiers, so every /64 has the same host capacity whatever the site prefix. The interesting number is usually how many /64s a site receives: a /48 contains 65,536 of them and a /56 contains 256. Counts above 2^53 cannot be represented exactly as a JavaScript number, so they appear as the full integer with a scientific approximation beside it.

Compressed output follows RFC 5952: the longest run of zero groups becomes ::, hex digits are lowercase, and leading zeros in each group are dropped. The expanded form shows all eight four-digit groups for copying into tools that do not accept ::.

Address and mask input

Routers and older configuration files print an address and a dotted-decimal mask on the same line. Paste 192.168.1.77 255.255.255.0 and the mask is converted to /24, then the result shows the network it belongs to, 192.168.1.0/24. A mask whose ones are not contiguous, such as 255.255.0.255, is rejected because it does not describe a CIDR block.

Limits

The Split list stops at 4,096 subnets to keep the page responsive. Range to CIDR handles any span, including the whole IPv6 space, because the output grows with the number of blocks rather than the number of addresses. Scope labels cover the common reserved ranges from RFC 1918, RFC 6598, RFC 4193 and RFC 4291; they are a hint about where an address sits, not a WHOIS lookup, and nothing here queries the network.

Frequently Asked Questions

A CIDR block such as 10.0.0.0/22, an IPv4 address followed by a dotted mask such as 192.168.1.5 255.255.255.0, a bare address (treated as a single host), or any IPv6 form including compressed and IPv4-mapped addresses. Each mode reads one or two of these fields.

The first address in an IPv4 block is the network address and the last is the broadcast address, so neither is assigned to a device. A /31 is the exception: RFC 3021 lets both addresses be used on a point-to-point link, and a /32 is a single host.

IPv6 has no broadcast. It uses multicast groups instead, so every address in a block is assignable and the host count equals the block size. A /64 holds 18,446,744,073,709,551,616 addresses.

Enter a longer prefix than the parent block. The block is divided evenly into 2^(new prefix minus old prefix) subnets, each listed with its network, usable range and host count. The list stops at 4096 rows, and the row count tells you how many were left out.

The smallest set of CIDR blocks that covers every address from the first to the last, inclusive. A range that is not aligned to a power of two needs several blocks: 10.0.0.1 to 10.0.0.254 takes 14 blocks, while 192.168.0.0 to 192.168.3.255 is exactly one /22.

The bitwise inverse of the subnet mask. A /22 has netmask 255.255.252.0 and wildcard 0.0.3.255. Cisco access lists and some firewall rules take the wildcard instead of the mask.

Yes. Put the address and the dotted-decimal mask on one line separated by a space. The mask must be contiguous ones followed by zeros; a mask like 255.255.0.255 is rejected.

Explore Our Tools

Browse all tools