CIDR / Subnet Calculator for IPv4 and IPv6

Enter an address with a prefix length, netmask or wildcard mask to get the network, broadcast and usable host range, test whether an address belongs to the subnet, and split it into smaller subnets.

Loading tool…

About the CIDR Calculator

CIDR notation (RFC 4632) writes a network as an address and a prefix length: in 192.168.10.37/22 the first 22 bits name the network and the remaining 10 bits number the hosts. The netmask is those 22 one-bits written as an address (255.255.252.0); the wildcard mask used by Cisco ACLs and OSPF is its inverse (0.0.3.255). The network address has all host bits 0, the broadcast address has them all 1, and everything in between can be given to hosts — 210 − 2 = 1,022 here. Two prefixes are special: a /31 has no network or broadcast address and both of its addresses are usable on point-to-point links (RFC 3021), and a /32 is a single host.

The calculator accepts a prefix length, a dotted netmask or a wildcard mask, and rejects masks whose one-bits are not contiguous, such as 255.0.255.0. Besides the ranges it shows the binary form with the network/host boundary marked, the historical class, the purpose of the block from the IANA special-purpose registry — private (RFC 1918), carrier-grade NAT 100.64.0.0/10, loopback, link-local, documentation, multicast — and the in-addr.arpa zone for reverse DNS. IPv4 arithmetic is done on unsigned 32-bit integers, so /0 and 255.255.255.255 give correct results.

IPv6 prefixes are calculated with 128-bit integers. Addresses are printed in the canonical form of RFC 5952: lower-case hexadecimal, no leading zeros, and :: for the longest run of zero groups. You get the expanded form, the first and last address, the exact number of addresses, the number of /64 networks inside the prefix, the address type (global unicast, unique local fc00::/7, link-local fe80::/10, multicast, documentation 2001:db8::/32, IPv4-mapped) and the ip6.arpa zone. Everything runs in your browser.

How to use it

  1. Type an address with a prefix (192.168.10.37/22), a netmask (10.0.0.5 255.255.252.0), a wildcard mask, or an IPv6 prefix (2001:db8:abcd::1/56).
  2. Drag the prefix slider, or click a row of the prefix table, to see how the network changes.
  3. Read the network, host range and masks; copy any value with its Copy button.
  4. Enter another address to test whether it is inside the subnet.
  5. Choose a new prefix length under “Split into subnets” and copy the list of subnets.

Frequently asked questions

How many hosts are in a /24, /26 or /30?
A /24 has 256 addresses and 254 usable hosts, a /26 has 64 addresses and 62 hosts, a /30 has 4 addresses and 2 hosts. The rule is 2^(32 − prefix) addresses, minus the network and broadcast addresses. A /31 has 2 usable addresses (RFC 3021) and a /32 has 1.
What is the difference between a netmask and a wildcard mask?
They are inverses of each other. The netmask 255.255.255.0 marks the network bits with ones; the wildcard mask 0.0.0.255 marks the bits that may vary. Cisco access lists and OSPF network statements use wildcard masks.
Which IPv4 ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Also not routed on the Internet: 100.64.0.0/10 (carrier-grade NAT), 169.254.0.0/16 (link-local) and 127.0.0.0/8 (loopback).
Why is an IPv6 subnet almost always a /64?
Stateless address autoconfiguration (SLAAC) needs 64 bits for the interface identifier, so a LAN gets a /64. Sites usually receive a /48 or /56 and split it into /64 networks; point-to-point links often use a /127 (RFC 6164).

Related tools