IPv4 & IPv6 Subnet Calculator (CIDR)

Enter an IPv4 or IPv6 address and CIDR prefix to calculate its network boundary, address range, mask or host portion and total address capacity.

You can also enter CIDR notation directly, such as 192.168.1.10/24 or 2001:db8::1/64.

Try an example:

What is an IP subnet calculator?

An IP subnet calculator converts an IPv4 or IPv6 address and CIDR prefix into the information needed to plan or troubleshoot a network. For IPv4 it identifies broadcast, subnet mask, wildcard mask and usable hosts. For IPv6 it identifies the prefix boundary, complete address range, hexadecimal prefix mask and host portion.

This calculator runs locally in your browser. The address you enter is not sent to our server. If you need information about a public address instead, use the IP Address Lookup.

How to use the subnet calculator

Enter an IPv4 address with a prefix from 0 to 32, or an IPv6 address with a prefix from 0 to 128, and select Calculate. The tool identifies the network boundaries and address capacity locally in your browser.

What is CIDR notation?

Classless Inter-Domain Routing (CIDR) writes a prefix after an IP address, such as 192.168.1.10/24 or 2001:db8::1/64. The prefix says how many bits belong to the network. IPv4 has 32 bits and IPv6 has 128 bits; a larger prefix creates a smaller address range.

How My IP calculates an IPv4 subnet

The calculator follows the same bitwise steps used when subnetting by hand:

  1. It validates four decimal octets from 0 to 255 and a CIDR prefix from 0 to 32.
  2. It converts the IPv4 address to one unsigned 32-bit number.
  3. It creates a mask with the prefix bits set to 1 and the remaining host bits set to 0.
  4. The network address is calculated with IP AND subnet mask.
  5. The wildcard mask is the inverse of the subnet mask, and the broadcast address is network OR wildcard.
  6. For traditional subnets, the first and last addresses are reserved and the usable range lies between them.

The tool does not call an IP information service and does not estimate the answer. The same IPv4 address and prefix always produce the same mathematical boundaries.

How My IP calculates an IPv6 prefix

The calculator expands compressed IPv6 notation to eight hexadecimal groups, converts the address to a 128-bit integer and applies the selected prefix mask. It then returns the network address, first and last addresses in the prefix, hexadecimal mask, host-bit count and total capacity. IPv6 does not use broadcast addresses or dotted-decimal subnet masks.

Subnet calculation examples

These examples show how the CIDR prefix changes the network size, address range and capacity for IPv4 and IPv6.

Example: 192.168.1.10/24

Network
192.168.1.0
Broadcast
192.168.1.255
Usable range
192.168.1.1–192.168.1.254
Usable hosts
254

Example: 203.0.113.7/30

Network
203.0.113.4
Broadcast
203.0.113.7
Usable range
203.0.113.5–203.0.113.6
Usable hosts
2

Example: 172.16.8.40/20

Subnet mask
255.255.240.0
Network
172.16.0.0
Broadcast
172.16.15.255
Usable range
172.16.0.1–172.16.15.254
Usable hosts
4,094

IPv6 example: 2001:db8:abcd:12::1/64

Network
2001:db8:abcd:12::
Last address
2001:db8:abcd:12:ffff:ffff:ffff:ffff
Host bits
64
Total addresses
18,446,744,073,709,551,616

In the /20 example, the third mask octet is 240, creating blocks of 16. Because the entered third octet is 8, it belongs to the block from 0 through 15. That makes 172.16.0.0 the network and 172.16.15.255 the broadcast address.

Common IPv4 CIDR sizes

Common IPv4 CIDR prefixes, subnet masks and host counts
CIDR Subnet mask Total addresses Traditional 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
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2 for point-to-point links
/32 255.255.255.255 1 1 host route

Understanding the results

  • Network address: identifies the beginning of the subnet.
  • Broadcast address: reaches every traditional IPv4 host in the subnet; IPv6 does not use broadcast.
  • Subnet mask: separates network bits from host bits.
  • Wildcard mask: is the inverse of the subnet mask and is often used in access-control rules.
  • Address range: shows the calculated IPv4 host range or the first and last IPv6 addresses in the prefix.

Choosing a subnet for the number of devices

When planning a traditional IPv4 LAN, allow one address for every device interface plus room for gateways, printers, access points, servers and future growth. Then choose the smallest subnet whose usable-host count still covers that total.

  • Up to 14 usable addresses: a /28 may be sufficient.
  • Up to 30 usable addresses: use at least a /27.
  • Up to 62 usable addresses: use at least a /26.
  • Up to 126 usable addresses: use at least a /25.
  • Up to 254 usable addresses: use at least a /24.

For example, a network expected to contain 50 active interfaces needs at least a /26, which supplies 64 total addresses and 62 traditional usable addresses. A larger allocation may be appropriate when the network is expected to grow.

Important interpretation notes

  • Address class is historical: Class A, B and C labels are included as a learning aid. Modern routing and allocation use CIDR prefixes instead of classful boundaries.
  • Scope describes the entered address: private, public, loopback, link-local, CGNAT, documentation and other special ranges are identified from the IP supplied. The label is not a reachability test.
  • Documentation addresses are not public targets: ranges such as 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for examples.
  • /31 and /32 are special cases: this calculator treats a /31 as a two-address point-to-point subnet and a /32 as one host route rather than subtracting network and broadcast addresses.
  • IPv6 uses different results: the calculator shows prefix boundaries and host bits instead of IPv4 broadcast and wildcard behavior.

Subnet calculator questions

What is CIDR notation?

CIDR combines an IP address with a slash prefix. In 192.168.1.10/24, the first 24 bits identify the network and the remaining 8 bits identify addresses within it.

What does a subnet calculator show?

For IPv4 it shows network, broadcast, masks and usable hosts. For IPv6 it shows the prefix range, hexadecimal mask, host bits, address capacity and scope.

How many usable hosts are in a /24?

A traditional /24 contains 256 addresses. After reserving the network and broadcast addresses, 254 remain available for hosts.

Are /31 and /32 networks supported?

Yes. This calculator treats a /31 as a two-address point-to-point subnet and a /32 as one host route.

Does the calculator support IPv6?

Yes. It accepts full or compressed IPv6 addresses with prefixes from /0 to /128, including common /64, point-to-point /127 and single-address /128 prefixes.