IP Subnet Calculator

Calculate the network address, broadcast address, usable host range and host count for an IPv4 address and CIDR prefix.

How to use this calculator

  1. 1Enter an IP address within the network, and the CIDR prefix length.
  2. 2The calculator works out the subnet boundaries regardless of which address inside the subnet you enter.

How the calculation works

Network = IP AND Mask. Broadcast = Network OR (NOT Mask). Usable hosts = 2^(32 − prefix) − 2
Mask
A run of 1-bits equal to the prefix length, followed by 0-bits, e.g. /24 = 11111111.11111111.11111111.00000000
NOT Mask
The wildcard mask — every bit flipped, marking the host portion of the address

The network address (all host bits 0) and broadcast address (all host bits 1) identify the subnet itself and its broadcast target, not individual hosts — which is why they are excluded from the usable count for any prefix shorter than /31.

Worked example

192.168.1.0/24

  1. 1.A /24 mask is 255.255.255.0 — the last octet is entirely host bits.
  2. 2.Network address: 192.168.1.0. Broadcast address: 192.168.1.255.
  3. 3.Usable hosts: 2⁸ − 2 = 254, from 192.168.1.1 to 192.168.1.254.

Result: 254 usable hosts, 192.168.1.1–192.168.1.254

What IP addressing and subnetting solve

Every device on an IPv4 network needs a unique 32-bit address to be reachable, but treating each of the roughly 4.3 billion possible addresses as an unstructured flat list would make routing between networks essentially impossible — a router would need to know the specific path to every single address individually. Subnetting solves this by splitting the address into a network portion and a host portion: routers only need to know how to reach a network as a whole, and delivery to the specific host within that network becomes a local problem, handled once traffic arrives.

How CIDR notation and subnet masks work

CIDR notation writes a network as an address followed by a slash and a number, like 192.168.1.0/24 — that number is the prefix length, the count of leading bits reserved for the network portion. A larger prefix number means more bits go to the network and fewer are left for hosts, so a /24 network (256 addresses) is smaller than a /16 network (65,536 addresses), even though 24 is a larger number than 16. The subnet mask is just another way of expressing the same boundary: a run of 1-bits equal to the prefix length, followed by 0-bits — 255.255.255.0 for a /24 — and a device combines its own address with the mask to work out which addresses share its local network.

Where subnetting decisions actually get made

Working out subnet boundaries isn’t just a networking-class exercise — it comes up in ordinary infrastructure work:

  • Home and office routersa typical home router hands out addresses on a /24 network (192.168.1.0/24 or similar), which comfortably covers a few dozen devices without any planning required.
  • Cloud VPC designsetting up a Virtual Private Cloud on AWS, Azure or GCP means explicitly choosing CIDR ranges for each subnet, deciding up front how many addresses each tier — web, application, database — is likely to need.
  • Segmenting a network by functionsplitting one physical network into several subnets or VLANs — guest Wi-Fi, staff devices, servers — is a common way to isolate traffic and apply different security rules to each group.
  • Container and orchestration networkingplatforms like Kubernetes assign a CIDR range to each node so that pods scheduled on that node get addresses from a predictable, non-overlapping block.

Mistakes that come up when planning a subnet

A few misunderstandings account for most subnetting errors:

  • Assigning the network or broadcast address to a devicethe very first address in a subnet (all host bits 0) identifies the network itself, and the very last (all host bits 1) is the broadcast address — neither is usable by an individual device, except in the special /31 point-to-point case.
  • Reading the prefix length backwardsit’s easy to assume a bigger number after the slash means a bigger network, when it’s the opposite — a larger prefix number leaves fewer bits for hosts, producing a smaller network.
  • Overlapping rangesconnecting two networks that were independently assigned overlapping private address ranges, both using 192.168.1.0/24, say, is a routine and painful problem when merging office networks or setting up a VPN between two sites.

What this assumes, and where it stops

Assumptions

  • IPv4 only — IPv6 uses a completely different addressing scheme and is not covered here.

Limitations

  • Does not account for further subnetting (VLSM) within the given range, or reserved ranges used by some networks for other purposes.

Common questions

What does the /24 actually mean?

It is the CIDR notation for the subnet mask — the number of leading bits that are fixed (the network portion). /24 means the first 24 bits are the network, leaving the last 8 bits (256 possible values) for hosts. A smaller number after the slash means a larger network; a larger number means a smaller one.

Why are 2 addresses always subtracted from the total?

Every subnet reserves its very first address (the network address, used to identify the subnet itself) and its very last address (the broadcast address, used to send to every host on the subnet at once) — neither can be assigned to an individual device, which is why usable hosts is always 2 less than the total size, except in the special /31 and /32 cases.

Sources

Formula and content last reviewed on .

Results are estimates for information only, not professional advice.

Report an error

Tools people commonly use alongside the ip subnet calculator.

See all developer tools calculators →