N NetCalc

Home / Subnet calculator

IPv4 Subnet Calculator

Enter an address and a prefix length (or a dotted netmask). The calculator returns the network address, broadcast address, usable host range and a full bit-by-bit breakdown — plus how each value is derived.

Four octets, 0–255. Example: 10.0.0.5
Either /24 or 255.255.255.0
Network address
—
Broadcast address
—
First usable host
—
Last usable host
—
Total addresses
—
Usable hosts
—
Subnet mask
—
Wildcard mask
—
CIDR notation
—
Address type
—
Binary breakdown
network bitshost bits

How the result is derived

Every subnet calculation rests on one operation: a bitwise AND between the address and the mask.

1. Turn the prefix into a mask

A prefix of /24 means the first 24 bits are 1 and the rest are 0, which is 11111111.11111111.11111111.00000000 — that is 255.255.255.0 in decimal. The number after the slash is the count of leading ones.

2. AND the address with the mask

Line the address up with the mask and keep a bit only where both are 1. The result is the network address — the first address in the block, where every host bit is 0.

  11000000.10101000.00001010.00100101   192.168.10.37
| 11111111.11111111.11111111.00000000   255.255.255.0
= 11000000.10101000.00001010.00000000   192.168.10.0

3. Invert the mask for the broadcast

The wildcard mask is the bitwise inverse of the subnet mask. OR the network address with the wildcard and every host bit becomes 1 — that is the broadcast address, the last address in the block.

  11000000.10101000.00001010.00000000   192.168.10.0
| 00000000.00000000.00000000.11111111   0.0.0.255
= 11000000.10101000.00001010.11111111   192.168.10.255

4. Count the hosts

With h host bits you get 2h addresses in total. The network and broadcast addresses are reserved, so a normal subnet gives 2h − 2 usable hosts. /24 has 8 host bits, so 256 total and 254 usable — from .1 to .254.

Two edge cases break that rule: /31 (RFC 3021 point-to-point) both addresses are usable, and /32 is a single host with no network or broadcast address at all.

Notes on address types

RangeMeaning
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
Private (RFC 1918) — never routed on the public internet
127.0.0.0/8Loopback
169.254.0.0/16Link-local / APIPA — self-assigned when DHCP fails
100.64.0.0/10Carrier-grade NAT (RFC 6598)
224.0.0.0/4Multicast
Tip: the same tool works backwards. Type an address and a mask in dotted form, and the CIDR notation line tells you which prefix that mask corresponds to.

Related