Developer Tool

IP Subnet Calculator (IPv4)

Enter an IPv4 address and CIDR prefix to see its network, mask, broadcast address and usable host range.

Maintained by Kumara Samigari LokeshMethod: bitwise AND of address and maskMethods and limitations

What this calculator does

Enter an IPv4 address and a prefix length from 0 to 32. The calculator returns the network address, subnet mask, broadcast address, number of usable hosts, and the first and last usable addresses.

How it works

The prefix length says how many leading bits identify the network. The mask has that many 1 bits.

Network = address AND mask

Broadcast = network OR (NOT mask)

Usable hosts = 2(32 − prefix) − 2, because the network and broadcast addresses are reserved. /31 (point-to-point links, RFC 3021) and /32 (a single host) are treated as fully usable.

Worked examples

  • 192.168.1.10/24: network 192.168.1.0, mask 255.255.255.0, broadcast 192.168.1.255, 254 usable hosts from .1 to .254.
  • 10.0.5.77/26: network 10.0.5.64, mask 255.255.255.192, broadcast 10.0.5.127, 62 usable hosts from .65 to .126.

Common prefix sizes

  • /30: 4 addresses, 2 usable
  • /29: 8 addresses, 6 usable
  • /28: 16 addresses, 14 usable
  • /24: 256 addresses, 254 usable
  • /16: 65,536 addresses, 65,534 usable

Each step down in prefix length doubles the size of the block.

Practical notes

In cloud networks, providers reserve extra addresses in each subnet (AWS reserves 5, for example), so usable counts are lower than this calculator shows. Private ranges for internal networks are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. IPv6 is not supported.

Common mistakes

  • Assigning the network or broadcast address to a device.
  • Confusing the prefix /26 with a mask of 255.255.255.26.
  • Forgetting provider-reserved addresses when planning cloud subnets.

FAQs

How many hosts are in a /24?

254 usable hosts out of 256 addresses.

What is CIDR notation?

Writing an address with a slash and the number of network bits, such as 192.168.1.0/24.

Why are /31 subnets fully usable?

RFC 3021 allows both addresses on point-to-point links, since no broadcast address is needed.

Does it support IPv6?

No, IPv4 only.

How do I convert a mask to a prefix?

Count the 1 bits. 255.255.255.192 has 26.