English

IP Address & CIDR Calculator

Enter a CIDR such as 192.168.1.0/24 or 2001:db8::/32, or an IP address with a subnet mask, to calculate the network address, address range, number of addresses, subnet mask, and more. IPv4 and IPv6 are detected automatically.

All calculations run in your browser. The addresses you enter are not sent to our server, and results are not stored.

Examples:

What is CIDR?

CIDR (Classless Inter-Domain Routing) is a notation that expresses a range of IP addresses as "first address/prefix length". 192.168.1.0/24 means all addresses whose first 24 bits are 192.168.1, that is, the 256 addresses from 192.168.1.0 to 192.168.1.255.

The prefix length is the number of bits that identify the network (the network part). The remaining bits (the host part) identify devices within that network. Each time the prefix length grows by 1, the number of addresses in the range is halved.

CIDR is used wherever you specify a range of IP addresses: firewall and security group allow lists, cloud VPC and subnet design, router routes, and access control in nginx or Apache.

Main fields in the result

Network address
The first address of the range, with all host bits set to 0. It represents the network itself, so in IPv4 it is normally not assigned to a device.
Broadcast address
The last address of an IPv4 range, with all host bits set to 1. It is used to send to every device on the network, so it is not assigned to a device. IPv6 has no broadcast.
Usable host range and number of hosts
The range and number of IPv4 addresses that can be assigned to devices. The network and broadcast addresses are excluded, so it is 2 less than the number of addresses (except for /31 and /32).
Subnet mask
A value with the network bits set to 1 and the host bits set to 0. /24 is 255.255.255.0. OS and router settings use it instead of the prefix length.
Wildcard mask
The subnet mask with its bits inverted (/24 is 0.0.0.255). It is used in ACL and OSPF settings on Cisco and other routers.
Reverse DNS zone name
The name of the DNS zone used to look up a host name from an IP address (PTR records). It is built by reversing the address under in-addr.arpa for IPv4 and ip6.arpa for IPv6.

CIDR and subnet mask cheat sheet

Common prefix lengths with their subnet masks and numbers of addresses. The IPv4 number of hosts excludes the network and broadcast addresses.

IPv4

Prefix lengthSubnet maskWildcard maskAddressesHosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

IPv6

Prefix lengthAddressesNumber of /64sTypical use
/3279,228,162,514,264,337,593,543,950,336 (2^96)4,294,967,296 (2^32)Allocation to ISPs and large organizations
/481,208,925,819,614,629,174,706,176 (2^80)65,536 (2^16)Assignment to an organization or site
/564,722,366,482,869,645,213,696 (2^72)256 (2^8)Assignment to a home or small site
/6418,446,744,073,709,551,616 (2^64)-A single subnet (LAN). SLAAC works with this length
/1272 (2^1)-Links between routers (RFC 6164)
/1281-A single address

Common mistakes

Leaving host bits set
192.168.1.130/24 means the same range as 192.168.1.0/24. Firewalls and other systems may reject it or interpret a different range than you intended. This tool converts it to the network address and tells you so.
Misreading the range of 172.16.0.0/12
The private range 172.16.0.0/12 is 172.16.0.0 to 172.31.255.255, not 172.0.0.0 to 172.255.255.255. Addresses from 172.32.0.0 onward are public.
Getting the prefix length backwards
The larger the prefix length, the smaller the range. /16 is 256 times as large as /24. Routers choose the matching route with the longest prefix length (longest match).
Thinking /31 is unusable
/31 has only 2 addresses, leaving 0 hosts after removing the network and broadcast addresses. On a link that directly connects two devices, however, RFC 3021 lets you assign both addresses to devices.
Making IPv6 subnets smaller than /64
In IPv6, a LAN subnet should normally be /64. Stateless address autoconfiguration (SLAAC) assumes /64, so splitting into /80 or similar may break it.

Thinking about IPv6 ranges

An IPv6 address is 128 bits, written as hexadecimal groups of 16 bits separated by colons. A run of zeros can be shortened to :: once. This tool shows results in the format recommended by RFC 5952 (lowercase, longest run of zeros shortened).

In IPv6, a single subnet is usually /64, and organizations or sites are assigned /48, /56, and so on. Even a /64 subnet has 2 to the 64th power (about 18 quintillion) addresses, so ranges are rarely sized by counting hosts as in IPv4.

IPv4-mapped addresses such as ::ffff:192.0.2.1 represent IPv4 traffic on IPv6 sockets. This tool also shows the IPv4 address contained in them.

How to use

  1. Enter a CIDR (192.168.1.0/24), an IP address with a subnet mask (192.168.1.10 255.255.255.0), or just an IP address.
  2. The result is calculated as you type. You can also change the prefix length with the select box next to the input field.
  3. Use "Copy" on each field to copy its value, or "Copy all" to copy the whole result. The page URL includes your input, so you can share the same result by sending the URL.

FAQ

How many devices can I connect to a /24?

A /24 has 256 addresses, and 254 of them can be assigned to devices after excluding the network and broadcast addresses. In practice, one of them is also used by the router (default gateway).

How do I get the prefix length from a subnet mask?

The prefix length is the number of consecutive 1s from the start when the subnet mask is written in binary. 255.255.255.0 has 24 ones, so it is /24. If you enter "IP address subnet mask" in the input field, the tool converts it to CIDR notation.

What happens if I enter only an IP address?

IPv4 is calculated as /32 and IPv6 as /128 (a single address), and the tool shows the address type and the reverse (PTR) name. To calculate a range, choose a prefix length.

Does it support IPv6?

Yes. From an IPv6 CIDR, it calculates the first and last addresses of the range, the number of addresses, the number of /64s, the expanded notation, the reverse DNS zone names, and more. Even very large numbers of addresses are shown exactly.

Are the addresses I enter sent or stored?

All calculations run in your browser, and the addresses you enter are not sent to our server. Results are not stored either. For sharing, your input is placed after the # in the URL, but that part is never sent to the server.