Skip to content
CalcTide logo
Tech

Subnet Calculator

A /24 subnet contains 256 total addresses and 254 usable hosts, because the network and broadcast addresses are reserved. This subnet calculator takes any IPv4 address and CIDR prefix and returns the subnet mask, network address, broadcast address, first usable host, last usable host, and total usable host count. Enter an address like 192.168.1.34 with a prefix like /24, and the tool works out exactly which block of addresses that network covers and where the assignable range starts and ends. It is built for network engineers, sysadmins, students studying for certification exams, and anyone configuring routers, firewalls, or DHCP scopes who needs a fast, accurate answer instead of working through binary math by hand.

TechBy

Quick answer

The network address is the first address in a subnet and identifies the subnet as a whole. It cannot be assigned to a device.

What this tells you

  • The network address is the first address in a subnet and identifies the subnet as a whole. It cannot be assigned to a device.
  • The broadcast address is the last address in a subnet and is reserved for sending a message to every host on that subnet at once.
  • Usable hosts are every address between the network and broadcast addresses, so a standard subnet's usable count is always the total address count minus 2.
  • The subnet mask (or its CIDR equivalent, like /26) sets the boundary between the network portion of the address and the host portion.
  • Smaller CIDR numbers describe bigger networks with more hosts, while larger CIDR numbers describe smaller networks with fewer hosts.
  • The two edge cases, /31 and /32, do not follow the normal network/broadcast/host pattern because there is no room to reserve those addresses.

How to Use

  1. 1Enter a valid IPv4 address in dotted-decimal form, such as 192.168.1.34 or 10.0.5.130.
  2. 2Enter the CIDR prefix length, a number from 0 to 32, that describes how many leading bits belong to the network. 24 is a common default for small local networks.
  3. 3Click Calculate to run the subnet math against the address and prefix you entered.
  4. 4Read the network address, broadcast address, subnet mask, first host, last host, and usable host count from the results.
  5. 5If you are planning an actual network, double-check the CIDR prefix against your ISP documentation, router configuration, or IP allocation plan before applying the result to live equipment.

How It Works

Formula

Mask = 32 leading 1-bits set by CIDR, Network = IP AND Mask, Broadcast = Network OR (NOT Mask)

Every IPv4 address is really a 32-bit number split into a network portion and a host portion. The CIDR prefix says how many of those 32 bits belong to the network. A /24 prefix sets the first 24 bits to 1 and the remaining 8 bits to 0, which produces the subnet mask 255.255.255.0. To find the network address, the calculator applies a bitwise AND between the IP address and the mask, which clears every host bit to 0 and leaves the network's starting address. To find the broadcast address, it flips the mask (turning every network bit to 0 and every host bit to 1) and applies a bitwise OR against the network address, which sets every host bit to 1 and produces the subnet's last address. The number of host bits is 32 minus the CIDR prefix, so the subnet holds 2 raised to that power total addresses. Because the network and broadcast addresses are both reserved in a standard subnet, the usable host count is that total minus 2. The two exceptions are /31, a point-to-point link where RFC 3021 allows both addresses to be used as hosts with 0 addresses set aside, and /32, a single host route with exactly one address and 0 usable hosts in the range sense.

Calculation note: values are processed in the order shown above, using the current input units.

Worked Examples

Typical /24 home or office subnet

I P192.168.1.34
C I D R24
ResultNetwork 192.168.1.0, Broadcast 192.168.1.255, Mask 255.255.255.0, Hosts 254

A /24 prefix leaves 8 host bits, giving 256 total addresses from 192.168.1.0 through 192.168.1.255. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255, so the usable range runs from 192.168.1.1 to 192.168.1.254, which is 254 assignable addresses. This is the default subnet size for most home routers and small office networks.

Split network with a /26 prefix

I P10.0.5.130
C I D R26
ResultNetwork 10.0.5.128, Broadcast 10.0.5.191, Mask 255.255.255.192, Hosts 62

A /26 prefix leaves 6 host bits, so each block covers 64 addresses. The address 10.0.5.130 falls inside the block that starts at 10.0.5.128, and that block's broadcast address is 10.0.5.191. Subtracting the network and broadcast addresses from the 64 total leaves 62 usable hosts, first host 10.0.5.129 and last host 10.0.5.190. Administrators use /26 blocks like this to split a /24 into four smaller subnets, often one per floor, VLAN, or department.

Wider /20 subnet for a growing network

I P172.16.10.5
C I D R20
ResultNetwork 172.16.0.0, Broadcast 172.16.15.255, Mask 255.255.240.0, Hosts 4094

A /20 prefix leaves 12 host bits, producing 4096 total addresses per block. The address 172.16.10.5 belongs to the block starting at 172.16.0.0 and ending at 172.16.15.255, giving 4094 usable addresses after removing the network and broadcast addresses. This size is common in larger office or campus networks where hundreds of devices need addresses inside a single subnet.

Small /28 subnet for a device cluster

I P203.0.113.77
C I D R28
ResultNetwork 203.0.113.64, Broadcast 203.0.113.79, Mask 255.255.255.240, Hosts 14

A /28 prefix leaves only 4 host bits, so the block covers 16 total addresses. The address 203.0.113.77 sits in the block from 203.0.113.64 to 203.0.113.79, leaving usable hosts from 203.0.113.65 to 203.0.113.78, which is 14 addresses. Small blocks like this are typical for a rack of servers, a wireless access point cluster, or a small branch office.

Point-to-point /30 link between two routers

I P192.168.5.9
C I D R30
ResultNetwork 192.168.5.8, Broadcast 192.168.5.11, Mask 255.255.255.252, Hosts 2

A /30 prefix leaves 2 host bits, giving exactly 4 total addresses, the smallest block that still follows the normal network and broadcast pattern. The network address is 192.168.5.8 and the broadcast address is 192.168.5.11, leaving exactly 2 usable addresses, 192.168.5.9 and 192.168.5.10. This size is the classic choice for a serial or WAN link that only ever connects two routers.

Edge case: /31 point-to-point link

I P10.10.10.10
C I D R31
ResultNetwork 10.10.10.10, Broadcast 10.10.10.11, Mask 255.255.255.254, Hosts 0 (both addresses usable per RFC 3021)

A /31 prefix leaves just 1 host bit, so the block has only 2 addresses total. Under the classic network/broadcast rule there would be 0 usable hosts, but RFC 3021 defines /31 specifically for point-to-point links and allows both 10.10.10.10 and 10.10.10.11 to be assigned to the two endpoints. This is why the calculator's usable host count shows 0 even though both addresses work in practice on modern equipment that supports RFC 3021.

Common mistakes

  • Typing an octet above 255 or a malformed address (like missing a dot) and expecting the calculator to guess the intent. IPv4 octets must be whole numbers from 0 to 255.
  • Confusing CIDR notation with the subnet mask itself. A /24 prefix and a 255.255.255.0 mask describe the same boundary, but they are written differently and mixing them up in a router configuration causes real outages.
  • Assuming every subnet loses exactly 2 addresses to network and broadcast. That rule only holds for /0 through /30. A /31 has 0 reserved addresses under RFC 3021 and a /32 is a single host with no separate network or broadcast address at all.
  • Entering the network address instead of a host address and assuming the tool made an error. Any address inside a block returns the same network and broadcast results, because those boundaries depend only on the prefix, not on which host address you typed.
  • Forgetting that a smaller CIDR number means a larger network. A /16 has far more hosts than a /28, and it is easy to reverse this when scanning configuration files quickly.
  • Using a subnet size that does not match the actual number of devices, which either wastes address space with an oversized block or leaves no room to grow with an undersized one.

Embed this calculator on your site

Drop this single line where you want the calculator to appear. It is responsive, mobile-friendly, resizes automatically, and is free to use with attribution.

<script src="https://calctide.com/embed.js" data-tool="subnet-calculator" async></script>

Preview the embed at /embed/subnet-calculator/.

Frequently Asked Questions

CIDR stands for Classless Inter-Domain Routing, and in practice it refers to the slash notation, like /24, that shows how many leading bits of an IP address form the network portion. It replaced the older class-based system (Class A, B, C) that fixed subnet sizes into rigid boundaries, letting network designers choose any prefix length from /0 to /32 instead.
A /24 subnet has 254 usable host addresses. The prefix leaves 8 host bits, giving 256 total addresses, and subtracting the reserved network address (the first) and broadcast address (the last) leaves 254 that can be assigned to devices.
Yes, but the usable-host logic works differently for those two prefixes. A /31 has only 2 addresses total and, under RFC 3021, both are usable on a point-to-point link even though the calculator reports 0 in the standard host-count field. A /32 identifies exactly one address with no separate network or broadcast address at all, commonly used for loopback interfaces or host routes.
CIDR notation and a subnet mask describe the exact same boundary in two different formats. The number after the slash counts how many leading bits of the address are network bits, so /24 means the first 24 bits identify the network and the remaining 8 bits identify hosts, which is the same split represented by the mask 255.255.255.0. Larger prefix numbers always mean smaller subnets with fewer host addresses.
The broadcast address is reserved because sending traffic to it delivers that traffic to every device on the subnet at once, which is a network-wide function rather than a single host's address. Assigning it to a device would make that device unreachable individually and could interfere with legitimate broadcast traffic like ARP requests or DHCP discovery messages.
The network address is the very first address in the block and identifies the subnet itself, while the first usable host is one address higher and is the lowest address that can actually be assigned to a device. For example, in the 192.168.1.0/24 subnet, 192.168.1.0 is the network address and 192.168.1.1 is the first usable host, commonly reserved for a router or gateway.
Choose the smallest prefix number (largest subnet) that comfortably covers your current device count plus reasonable growth room. A /28 with 14 usable hosts fits a small device cluster, a /24 with 254 usable hosts fits a typical office floor, and a /20 with 4094 usable hosts fits a larger campus segment, so match the block size to how many hosts you expect to add over the network's lifetime.
No, the subnet mask does not change the address you typed, it only defines how that address is interpreted for routing purposes. The calculator uses the mask to compute the network and broadcast boundaries around your entered address, but your original address stays exactly as entered.
Yes, the network, broadcast, and mask math is identical whether the address is a private range like 192.168.0.0/16 and 10.0.0.0/8 or a public, internet-routable address. This tool does not check whether an address belongs to a private or reserved range, so confirm separately that the address you are using matches your intended deployment.
It estimates subnet calculator outputs using the visible inputs and formula assumptions on this page.

Explore More in Tech