Subnet Calculator (CIDR)

Enter an IPv4 address with a CIDR prefix, for example 192.168.1.0/24, to calculate its network address, broadcast address, netmask, and usable host range. Any host address within the subnet works as input. Everything runs in your browser.

What CIDR notation means

An IPv4 address is 32 bits, usually written as four decimal octets. A CIDR prefix such as /24 states how many of those leading bits identify the network. The remaining bits identify the host within it.

For 192.168.1.0/24, the first 24 bits are the network, leaving 8 bits for hosts. In binary:

Address:  11000000.10101000.00000001.00000000
Mask:     11111111.11111111.11111111.00000000
          |------ network ------| |-host-|

Everything follows from that split:

With 8 host bits there are 2⁸ = 256 addresses, minus the network and broadcast addresses, giving 254 usable hosts.

Prefix reference table

CIDRNetmaskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/22255.255.252.010241022
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422 (point-to-point)
/32255.255.255.2551single host

Each step in the prefix halves or doubles the network size. Going from /24 to /25 splits one network into two, /26 into four, and so on.

Examples

CIDRNetworkBroadcastUsable hosts
192.168.1.0/24192.168.1.0192.168.1.255254
10.0.5.130/2610.0.5.12810.0.5.19162
172.16.0.0/20172.16.0.0172.16.15.2554094
192.168.1.5/32192.168.1.5192.168.1.5single host

The second row shows why entering any host address works: 10.0.5.130 with a /26 prefix belongs to the network starting at 10.0.5.128, so the calculator normalizes it down.

Private address ranges

Three IPv4 ranges are reserved for private networks and never routed on the public internet:

RangeCIDRAddressesTypical use
10.0.0.0 to 10.255.255.25510.0.0.0/816.7 millionLarge corporate networks
172.16.0.0 to 172.31.255.255172.16.0.0/121 millionMedium networks, Docker defaults
192.168.0.0 to 192.168.255.255192.168.0.0/1665,536Home and small office routers

Also worth recognizing: 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (an address in this range usually means DHCP failed), and 224.0.0.0/4 is multicast.

Practical subnetting

Splitting a network

To divide 192.168.1.0/24 into four equal subnets, add two bits to the prefix, giving /26. Each holds 64 addresses with 62 usable hosts:

The rule: adding n bits to the prefix creates 2n subnets.

Sizing a subnet

Work backwards from the host count, remembering to add two for the network and broadcast addresses. Needing 100 hosts means 102 addresses, so /25 with 126 usable hosts is the smallest fit. A /26 with 62 would be too small.

The /31 special case

Normally the network and broadcast addresses are unusable, which would leave a /31 with zero hosts. RFC 3021 makes an exception for point-to-point links, where both addresses are usable, since a link between exactly two routers needs no broadcast address. This saves addresses on links that would otherwise waste a /30.

Frequently asked questions

What if my address is not the network address?

Any host address within the subnet works. The calculator normalizes it down to the network address automatically.

Why are two addresses unusable in each subnet?

The first is the network identifier and the last is the broadcast address. Neither can be assigned to a host. The exceptions are /31 and /32.

What about /0 and /32?

Both are valid. /0 covers the entire address space and is used for default routes. /32 identifies exactly one host, commonly used in firewall rules and routing entries.

How do I calculate the number of hosts?

2(32 minus prefix) minus 2. For /26 that is 2⁶ minus 2 = 62.

What is the difference between a netmask and a CIDR prefix?

They express the same thing. /24 and 255.255.255.0 both mean the first 24 bits are the network portion. CIDR notation is simply more compact.

Does this handle IPv6?

Not currently. This calculator covers IPv4 only. IPv6 uses 128-bit addresses and different conventions, most notably /64 as the standard subnet size.

Related tools