CIDR Calculator

Calculate network, broadcast, host range, and masks for any CIDR block.

192.168.1.10/24
10.0.0.0 255.255.240.0
172.16.5.4/30
2001:db8:abcd:12::1/64

IP Range to CIDR

Enter the first and last IPv4 address of a range to get the smallest list of CIDR blocks that covers it exactly.

CIDR Calculator – IPv4 and IPv6 Subnets

Enter an IP address with a prefix length or subnet mask and instantly get everything you need to know about the network: network and broadcast addresses, first and last usable host, number of addresses, subnet mask, wildcard mask, IP class, address type, and binary representation. The calculator understands 192.168.1.10/24, 10.0.0.1 255.255.0.0, 10.0.0.1/255.255.0.0, and IPv6 blocks such as 2001:db8::/48.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) describes a network with an address and a prefix length: the number of leading bits that identify the network. In 192.168.1.0/24 the first 24 bits are the network, and the remaining 8 bits number the hosts, giving 256 addresses. The prefix is equivalent to a subnet mask with that many one-bits – /24 is 255.255.255.0, /16 is 255.255.0.0, and /26 is 255.255.255.192.

Common IPv4 prefix sizes

Prefix Subnet mask Addresses Usable hosts
/8 255.0.0.0 16,777,216 16,777,214
/16 255.255.0.0 65,536 65,534
/24 255.255.255.0 256 254
/26 255.255.255.192 64 62
/28 255.255.255.240 16 14
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2 (point-to-point, RFC 3021)
/32 255.255.255.255 1 1 (single host)

The network address (all host bits 0) and the broadcast address (all host bits 1) cannot be assigned to devices, which is why a /24 has 254 usable hosts. The wildcard mask is the inverse of the subnet mask and is used in Cisco ACLs and OSPF configuration.

Address type detection

The calculator tells you whether an address is public or belongs to a special range: private RFC 1918 networks (10/8, 172.16/12, 192.168/16), carrier-grade NAT (100.64/10), loopback, link-local, documentation ranges, multicast, or reserved space. For IPv6 it recognises global unicast, unique local (fc00::/7), link-local (fe80::/10), multicast, documentation (2001:db8::/32), and IPv4-mapped addresses.

IP range to CIDR

Firewall rules and cloud security groups usually need CIDR blocks, but allocations are often given as a range. Enter a start and end address in the second section to get the smallest set of CIDR blocks that covers the range exactly – 10.0.0.0 to 10.0.3.255 becomes 10.0.0.0/22.

To see addresses in other formats, try Binary to IP, Decimal to IP, or IPv6 to Binary.

Frequently Asked Questions

254. A /24 has 256 addresses; the first is the network address and the last is the broadcast address, leaving 254 for hosts.

Count the 1 bits in the mask. 255.255.255.0 has 24 one-bits, so it is /24. You can enter the mask directly (e.g. 10.0.0.1 255.255.240.0) and the calculator shows the prefix.

The bitwise inverse of the subnet mask – 0.0.0.255 for a /24. Cisco access lists and OSPF use it to say which address bits must match (0) and which are ignored (1).

Yes. Enter an IPv6 address with a prefix, such as 2001:db8:abcd:12::1/64, to get the network, first and last address, prefix mask, total number of addresses, and address type.