IP Subnet

Network, broadcast and host range from an IP/CIDR.

255.255.255.0
Subnet mask
192.168.1.0
Network
192.168.1.255
Broadcast
254
Usable hosts
192.168.1.1
First host
192.168.1.254
Last host

How to Use the IP Subnet Calculator

  1. Enter the IPv4 address in dotted-decimal format (e.g., 10.0.5.130) into the IP Address field.
  2. Enter either the CIDR prefix length (e.g., /26) or select the subnet mask from the dropdown (e.g., 255.255.255.192).
  3. Click **Calculate** to instantly display the subnet mask, network address, broadcast address, first/last host, and total usable hosts.
  4. Review the host range to confirm which addresses are valid for devices on that subnet.
  5. Use the **Clear** button to reset all fields and calculate a different subnet.

IPv4 Subnetting Formulas

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 — A 32-bit number with the first n bits set to 1 and the remaining (32 − n) bits set to 0.
  2. Network Address — Bitwise AND of the host IP address and the subnet mask.
  3. Broadcast Address — Bitwise OR of the network address and the bitwise NOT of the subnet mask (i.e., host bits all set to 1).
  4. Number of Hosts — Total addresses in the block minus the network and broadcast addresses.
  5. Host Range — From (Network Address + 1) to (Broadcast Address − 1).
  • IP — The 32-bit IPv4 address entered by the user, expressed in dotted-decimal notation (e.g., 192.168.1.45).
  • n — The CIDR prefix length — the number of leading 1-bits in the subnet mask (0–32). For example, /24 means n = 24.
  • Subnet Mask — A 32-bit mask with n ones followed by (32 − n) zeros, expressed in dotted-decimal (e.g., 255.255.255.0 for /24).
  • Network Addr — The base address of the subnet, obtained by zeroing all host bits (bitwise AND of IP and Subnet Mask).
  • Broadcast — The last address in the subnet, obtained by setting all host bits to 1 (bitwise OR of Network Addr and the inverted Subnet Mask).
  • Total Hosts — The total number of IP addresses in the subnet block, equal to 2 raised to the power of (32 − n).
  • Usable Hosts — The number of addresses assignable to devices — Total Hosts minus 2 (network and broadcast addresses are reserved).
  • First Host — The lowest assignable IP address in the subnet: Network Address + 1.
  • Last Host — The highest assignable IP address in the subnet: Broadcast Address − 1.

Worked Example: Subnetting 192.168.10.77/26

IP Address: 192.168.10.77 | CIDR Prefix: /26 (subnet mask 255.255.255.192)
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

What Your Result Means

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.

Understanding IP Subnet

Understanding IPv4 Subnetting

Why Subnetting Exists

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.

CIDR Notation

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.

Subnet Mask Quick Reference

| 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 |

Private Address Ranges (RFC 1918)

  • 10.0.0.0/8 — 16.7 million addresses, large enterprise networks
  • 172.16.0.0/12 — ~1 million addresses, medium networks
  • 192.168.0.0/16 — 65,536 addresses, home and small office networks

VLSM (Variable Length Subnet Masking)

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).

Special Addresses

  • /32 — A host route representing a single IP address (0 usable hosts in the traditional sense).
  • /31 — Used for point-to-point links (RFC 3021); contains 2 addresses, both usable (no network/broadcast convention applies).
  • /0 — The default route representing all IP addresses.

Common Mistakes

  • **Confusing the network address with the first host address** — The network address (all host bits = 0) is reserved and cannot be assigned to a device; the first usable host is always network address + 1.
  • **Forgetting to subtract 2 for usable hosts** — The formula is 2^(32−n) − 2, not 2^(32−n), because both the network and broadcast addresses are reserved.
  • **Using the wrong prefix for /31 and /32** — /31 links (RFC 3021) technically have 2 usable addresses with no broadcast, and /32 is a host route. Treat these as special cases.
  • **Entering a host address instead of a network address for routing** — Always use the network address (e.g., 192.168.1.0/24, not 192.168.1.5/24) when configuring routes or ACLs.
  • **Mixing up wildcard masks and subnet masks** — Cisco ACLs use wildcard masks (the bitwise inverse of the subnet mask). A /24 subnet mask of 255.255.255.0 has a wildcard mask of 0.0.0.255.
  • **Assuming Class-based boundaries** — Modern networking is fully classless (CIDR). A /20 network is perfectly valid even though the third octet crosses a Class C boundary.

Common Questions About IP Subnet

How do I find which subnet an IP address belongs to?

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.

How many subnets can I create from a /22 block using /26 subnets?

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.

What is the broadcast address used for?

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.

How do I convert a subnet mask like 255.255.240.0 to CIDR notation?

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.

What is VLSM and when should I use it?

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.

Frequently Asked Questions

What is the difference between a subnet mask and a CIDR prefix?

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.

How many usable hosts are in a /24 subnet?

A /24 subnet has 2^(32−24) = 256 total addresses. Subtract 2 for the network and broadcast addresses, leaving 254 usable host addresses.

Can I subnet a public IP address the same way?

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.

What does a /32 subnet mean?

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.

Why does the calculator show 0 usable hosts for a /31?

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.

What is a wildcard mask and how is it related to a subnet mask?

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.

Related Calculators

Sources

Only sources that have been reviewed are shown. Unverified citations are never published.

Spotted a calculation error?Report an Error
How this calculator works:MethodologyReport an Error

Report an issue or suggest a feature

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.

Manage options