Subnet Calculator

Work out an IPv4 subnet from IP and prefix.

How it is calculated

An IPv4 address has 32 bits. The CIDR prefix /p says the first p bits identify the network and the remaining 32 − p bits identify the host. The netmask is p ones followed by zeros. The network address is IP AND mask (host bits set to 0), the broadcast address is the network address with all host bits set to 1, and usable hosts are 232 − p − 2, because the network and broadcast addresses cannot be given to devices. The tool needs four octets from 0 to 255 and a prefix from 0 to 32. For /31 it shows 2 usable addresses (RFC 3021, point-to-point links, where there is no network or broadcast address to give up) and for /32 one host.

Worked example

Address 192.168.10.37 with prefix /26. Mask: 26 ones = 255.255.255.192. The last octet block size is 256 − 192 = 64, and 37 falls in the block 0–63. Network: 192.168.10.0. Broadcast: 192.168.10.63. Usable hosts: 26 − 2 = 62, from .1 to .62.

Try this example →

Common mistakes

  • Counting the network and broadcast addresses as usable hosts. A /26 holds 64 addresses but only 62 hosts.
  • Confusing the prefix with the number of hosts. A larger prefix like /30 means a smaller network.
  • Entering the mask (255.255.255.0) in the prefix field. Give the CIDR number, here 24.
  • Expecting the address you typed to be the network address. 192.168.10.37 is a host inside 192.168.10.0/26.
  • Assuming /31 has no use. Point-to-point links use both of its addresses (RFC 3021), and the tool shows 2.

Sources

About this calculator

This calculator works out an IPv4 subnet from an IP address and CIDR prefix length: it derives the subnet mask, the network address (IP bitwise-ANDed with the mask), the broadcast address (network address with all host bits set to 1), and the number of usable host addresses (2^(32−prefix) − 2, subtracting the network and broadcast addresses themselves).

Network engineers and system administrators use subnetting constantly when designing IP address plans — carving a larger network into smaller subnets for departments, VLANs, or cloud VPCs, sizing subnets to fit a known number of hosts without wasting address space, and configuring routers and firewalls.

Was this helpful?

You can pick up to 3 reactions.

Note from the editors

The usable host count subtracts the network and broadcast addresses, except for the two smallest subnets: a /31 shows 2, because on point-to-point router links RFC 3021 lets both addresses be assigned to the two ends, and a /32 shows 1, a single host or loopback. So read those small figures as special-case sizing, not as an error. Are you planning a LAN, a VPN range or a router link?

Comments

  • Be the first to comment.

Popular calculators

All Calculators