Advanced

Subnet / CIDR Calculator

Compute the network and broadcast addresses, usable host range, host count, subnet mask and wildcard mask for any IPv4 address and CIDR prefix.
Dotted-decimal, e.g. 10.0.0.5

/

0 to 32
Usable hosts
254

Network 192.168.1.0/24

Network address
192.168.1.0
Broadcast address
192.168.1.255
First host
192.168.1.1
Last host
192.168.1.254
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Total addresses
256
99%
1%
Usable hosts
Reserved (network + broadcast)
Address space /24 — 256 total addresses
Step by step
  1. 1

    Host bits

    32 − 24 = 8
  2. 2

    Total addresses

    2⁸ = 256
  3. 3

    Usable hosts

    256 − 2 = 254
    Two addresses are reserved: the network address and the broadcast address.
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Enter an IPv4 address and CIDR prefix to get the network and broadcast addresses, the first and last usable host, the total usable host count, and the subnet and wildcard masks. The mask is formed from the prefix, the network is IP AND mask, and usable hosts equal 2^(32−prefix)−2.

Formula
mask = 0xFFFFFFFF << (32 − prefix); network = ip & mask; broadcast = network | ~mask; usable hosts = 2^(32 − prefix) − 2
How this is calculated

The IPv4 address is parsed from dotted-decimal notation into a single 32-bit unsigned integer, with each of the four octets occupying 8 bits. The prefix length (the number after the slash in CIDR notation, 0–32) tells you how many leading bits identify the network; the remaining bits identify hosts within that network.

The subnet mask is built by shifting all-ones left by (32 − prefix) bits, so the network bits are 1 and the host bits are 0. The network address is the bitwise AND of the IP and the mask (host bits cleared to 0). The broadcast address ORs the network with the wildcard mask (the inverted subnet mask), setting every host bit to 1. The first usable host is the network address plus one and the last usable host is the broadcast address minus one.

Usable hosts equal 2^(32 − prefix) − 2, because the network and broadcast addresses cannot be assigned to a device. Two prefixes are special cases: a /31 has exactly 2 usable addresses (RFC 3021 point-to-point links use both), and a /32 describes a single host with 1 address. All arithmetic uses unsigned 32-bit operations (>>> 0) so results never go negative.

Frequently asked questions

In a normal subnet the first address is reserved as the network identifier and the last address is the broadcast address, so neither can be assigned to a device. That is why usable hosts equal the total addresses minus two for prefixes /30 and shorter.

The wildcard mask is the bitwise inverse of the subnet mask: where the mask has 1s the wildcard has 0s and vice versa. It is commonly used in access control lists and routing rules to indicate which bits of an address may vary.

A /32 represents a single host (one address, used for loopbacks or host routes). A /31 yields two addresses with no network/broadcast reservation, which RFC 3021 allows for point-to-point links so both ends are usable.

Also known as

subnet calculator
cidr calculator
network address
broadcast address
host range
ipv4 subnet
subnet mask calculator
ip subnet

APA

TG we-Calculate Editorial Team. (2026). Subnet / CIDR Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/subnet-calculator

Chicago

TG we-Calculate Editorial Team. "Subnet / CIDR Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/subnet-calculator.

IEEE

TG we-Calculate Editorial Team, "Subnet / CIDR Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/subnet-calculator

BibTeX

@misc{wecalculate_subnet_calculator, title = {Subnet / CIDR Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/subnet-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?