Network, broadcast and host range from an IP/CIDR.
Subnet Mask = ( 0xFFFFFFFF << (32 − n) ) & 0xFFFFFFFF Network Addr = IP & Subnet Mask Broadcast = Network Addr | (~Subnet Mask & 0xFFFFFFFF) Total Hosts = 2^(32 − n) Usable Hosts = 2^(32 − n) − 2 First Host = Network Addr + 1 Last Host = Broadcast − 1
Given an IPv4 address and a CIDR prefix length /n, the key subnetting values are derived as follows:
1. Subnet Mask: /26 → 11111111.11111111.11111111.11000000 = 255.255.255.192 2. Network Address: 192.168.10.77 AND 255.255.255.192 → 77 in binary = 01001101; 192 in binary = 11000000 → AND result = 01000000 = 64 → Network Address = 192.168.10.64 3. Broadcast Address: 192.168.10.64 OR 0.0.0.63 → 64 OR 63 = 127 (01000000 OR 00111111 = 01111111) → Broadcast = 192.168.10.127 4. First Host = 192.168.10.65 5. Last Host = 192.168.10.126 6. Usable Hosts = 2^(32−26) − 2 = 2^6 − 2 = 64 − 2 = 62
Result: Subnet Mask: 255.255.255.192 | Network: 192.168.10.64 | Broadcast: 192.168.10.127 | Host Range: 192.168.10.65 – 192.168.10.126 | Usable Hosts: 62
The result tells you that the IP address 192.168.10.77 belongs to the subnet 192.168.10.64/26. This subnet can accommodate 62 usable host addresses (192.168.10.65 through 192.168.10.126). The network address (192.168.10.64) identifies the subnet itself and cannot be assigned to a device; the broadcast address (192.168.10.127) is used to send packets to all hosts on the subnet and is also reserved.
IPv4 uses 32-bit addresses, giving roughly 4.3 billion unique addresses. Subnetting divides large IP address blocks into smaller, more manageable segments called subnets. This reduces broadcast traffic, improves security by isolating network segments, and makes efficient use of the limited IPv4 address space.
Classless Inter-Domain Routing (CIDR), introduced in RFC 1519 (1993) and refined in RFC 4632, replaced the old Class A/B/C system. A CIDR block is written as an IP address followed by a slash and the prefix length (e.g., 192.168.1.0/24). The prefix length tells you how many bits are the network portion; the rest are host bits.
| Prefix | Subnet Mask | Usable Hosts | Typical Use | |--------|-------------|--------------|-------------| | /30 | 255.255.255.252 | 2 | Point-to-point links | | /29 | 255.255.255.248 | 6 | Small office segment | | /28 | 255.255.255.240 | 14 | Small LAN | | /27 | 255.255.255.224 | 30 | Medium LAN | | /26 | 255.255.255.192 | 62 | Medium-large LAN | | /25 | 255.255.255.128 | 126 | Large LAN | | /24 | 255.255.255.0 | 254 | Standard office LAN | | /23 | 255.255.254.0 | 510 | Large campus segment | | /22 | 255.255.252.0 | 1,022 | Large enterprise | | /16 | 255.255.0.0 | 65,534 | Large private network |
VLSM allows network engineers to use different subnet sizes within the same network, allocating exactly as many addresses as each segment needs. For example, a WAN link needs only /30 (2 hosts), while a server farm might need /25 (126 hosts).
Perform a bitwise AND of the IP address and the subnet mask. The result is the network address of the subnet that IP belongs to. For example, 10.1.3.200 AND 255.255.255.0 = 10.1.3.0, so the IP belongs to the 10.1.3.0/24 subnet.
A /22 block has 2^(26−22) = 2^4 = 16 subnets of size /26. Each /26 provides 62 usable hosts, for a total of 16 × 62 = 992 usable host addresses across all subnets.
The broadcast address (all host bits set to 1) is used to send a packet to every device on a subnet simultaneously. For example, a DHCP Discover message is sent to the subnet broadcast address because the client does not yet have an IP address.
Convert each octet to binary: 255=11111111, 255=11111111, 240=11110000, 0=00000000. Count the leading 1-bits: 8+8+4+0 = 20. So 255.255.240.0 is equivalent to /20.
Variable Length Subnet Masking (VLSM) lets you assign different-sized subnets within the same address space. Use VLSM when different segments have very different host count requirements — for example, giving a /30 to a 2-router WAN link and a /23 to a large office floor — to avoid wasting addresses.
They represent the same information in different formats. A subnet mask (e.g., 255.255.255.0) is a 32-bit dotted-decimal number, while a CIDR prefix (e.g., /24) is simply the count of leading 1-bits in that mask. Both describe how many bits belong to the network portion of an address.
A /24 subnet has 2^(32−24) = 256 total addresses. Subtract 2 for the network and broadcast addresses, leaving 254 usable host addresses.
Yes. The subnetting math is identical for public and private IP addresses. ISPs commonly assign public CIDR blocks (e.g., a /29 giving 6 usable public IPs) using exactly the same formulas.
A /32 prefix means all 32 bits are the network portion — it represents a single, specific IP address with no host bits. It is used for host routes in routing tables and for loopback addresses.
Traditionally, /31 has 2 addresses (both reserved for network and broadcast), leaving 0 usable hosts. However, RFC 3021 allows /31 subnets on point-to-point links where both addresses are usable. Check whether your equipment supports RFC 3021 before using /31 links.
A wildcard mask is the bitwise complement (inverse) of a subnet mask. If the subnet mask is 255.255.255.0, the wildcard mask is 0.0.0.255. Wildcard masks are commonly used in Cisco ACL and OSPF configurations to specify which host bits to match.
Only sources that have been reviewed are shown. Unverified citations are never published.
Spotted an inaccuracy or have an idea to improve this calculator? Let us know.
We use cookies to operate the site, and — with your consent — to show advertising and measure usage. You can change your choice anytime in Cookie Settings.