Subnet Calculator

Enter an IPv4 or IPv6 address with a prefix or mask to get the network, broadcast, host range, wildcard mask, address type and a binary view. Split a network into smaller subnets.

Processed locally in your browser
Enter an address with a prefix or maskIPv4 and IPv6

Split into subnets

Lists the subnets of that size inside the network above.

Reading CIDR notation

192.168.1.130/26 means: the address 192.168.1.130, and the first 26 bits of it identify the network. The remaining 6 bits identify the host within that network. The prefix length replaces the older dotted subnet mask; /26 and 255.255.255.192 say the same thing. The calculator accepts either form.

address   192.168.1.130  = 11000000.10101000.00000001.10000010
mask /26  255.255.255.192 = 11111111.11111111.11111111.11000000
network   192.168.1.128   = 11000000.10101000.00000001.10000000  (address AND mask)
broadcast 192.168.1.191   = 11000000.10101000.00000001.10111111  (network OR NOT mask)
hosts     192.168.1.129 – 192.168.1.190  (62 usable)

The binary rows in the result colour the network bits and the host bits differently, so you can see exactly where the boundary falls.

Why two addresses are lost

In every IPv4 subnet of /30 or shorter, the all-zeros host address is the network address and the all-ones address is the broadcast address; neither can be assigned to an interface. A /24 therefore has 254 usable hosts, not 256. The exceptions are /31, defined by RFC 3021 for point-to-point links where both addresses are usable, and /32, a single host route.

Prefix lengths at a glance

PrefixMaskAddressesUsable hostsTypical use
/8255.0.0.016,777,21616,777,21410.0.0.0/8 private space
/16255.255.0.065,53665,534Site or VPC
/20255.255.240.04,0964,094Cloud subnet
/24255.255.255.0256254Classic LAN
/26255.255.255.1926462Small LAN or VLAN
/28255.255.255.2401614DMZ, small office
/30255.255.255.25242Point-to-point (legacy)
/31255.255.255.25422Point-to-point (RFC 3021)
/32255.255.255.25511Single host, loopback

Wildcard masks

A wildcard mask is the bitwise inverse of the subnet mask: 0.0.0.63 for /26. Cisco access lists and OSPF network statements use it, with 0 bits meaning “must match” and 1 bits meaning “don't care”. It is shown in the results so you can paste it directly.

Private and special ranges

The Type row identifies addresses reserved by the IANA special-purpose registries: RFC 1918 private ranges (10/8, 172.16/12, 192.168/16), loopback, link-local, CGNAT (100.64/10), the documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24), multicast and class E. For IPv6 it recognises loopback, link-local (fe80::/10), unique local (fc00::/7), documentation (2001:db8::/32), multicast and global unicast. Address classes (A, B, C) are shown for reference only; routing has been classless since 1993.

IPv6

IPv6 addresses are 128 bits written as eight 16-bit hexadecimal groups. Leading zeros in a group can be dropped and one run of zero groups can be replaced by ::. The calculator shows both the compressed and the fully expanded form, the network range, the number of addresses, and how many /64 subnets fit in the prefix. There is no broadcast address in IPv6 and no reserved “last address” in a subnet; every address in a /64 is assignable, though the all-zeros address is the subnet-router anycast address.

Splitting a network

Enter a longer prefix in the split section to enumerate the equal-size subnets it produces. Splitting 10.0.0.0/24 into /26 gives four subnets of 62 hosts each. For variable-length subnetting, split into the largest size you need first, then split one of those pieces further.

In code

# Python
import ipaddress
net = ipaddress.ip_network("192.168.1.130/26", strict=False)
net.network_address, net.broadcast_address, net.num_addresses   # 192.168.1.128, 192.168.1.191, 64
list(net.subnets(new_prefix=28))
ipaddress.ip_address("10.1.2.3").is_private                       # True

# Linux
ipcalc 192.168.1.130/26         # Debian/Ubuntu package "ipcalc"
sipcalc 2001:db8::1/64
navigateEnter openEsc close