What is a subnet, and what does this calculator do?
An IPv4 address is 32 bits, and every network splits them into two
parts: a prefix that names the network, and the remaining bits that
name a host inside it. A subnet is what you get when you fix the
prefix: all addresses sharing it can talk to each other directly,
and reaching anything outside it means going through a router. This
calculator takes any address and prefix — typed as
192.168.1.10/24, or as an address plus a dotted netmask —
and works out everything that follows from that split: the network
address, the broadcast address, the first and last assignable host,
how many addresses exist and how many you can actually use, the
netmask and wildcard mask, and whether the address lives in a private,
loopback, link-local or public range. It is the arithmetic every
network design starts with, done without the bit-twiddling by hand.
How to use this tool
- Type an IPv4 address and a prefix length — or leave the prefix blank and give a dotted netmask such as
255.255.255.192instead. - Press Calculate. The page opens pre-filled with
192.168.1.10/24, the classic home-network example, already calculated. - Read the table top to bottom: the network and broadcast rows bound the subnet; the usable range between them is what DHCP hands out and what you may assign statically.
- The binary view shows the address and mask bit by bit — the fastest way to see where the network part ends and the host part begins.
The maths, once, carefully
Everything follows from one AND operation. The netmask for a prefix of length p is p one-bits followed by 32−p zero-bits. AND the address with the mask and you get the network address; OR it with the inverted mask (the wildcard) and you get the broadcast address. The subnet contains 232−p addresses, from network to broadcast inclusive. Two of them are spoken for in the classic rules — the network address identifies the subnet itself, and the broadcast address reaches every host at once — leaving 232−p − 2 usable, which is why capacities always land two short of a round power of two: a /24 has 254 usable addresses, a /30 only 2. Modern practice made two exceptions, both implemented here: on a /31 point-to-point link there is no broadcast and RFC 3021 allows both addresses as hosts, and a /32 is a route to exactly one host.
The other thing the split decides is size versus count. Every bit you move from the host part to the network part doubles the number of subnets and halves each one: carving a /24 into /26s yields four subnets of 62 usable hosts each. Choosing a prefix is therefore always a bet about the future — too large wastes addresses you can never reclaim without renumbering, too small runs out at the worst possible moment. Calculating the real numbers, rather than the remembered ones, is the entire point of the tool.
Examples
192.168.1.10/24 — the address most home routers hand out:
network 192.168.1.0, broadcast 192.168.1.255,
usable range 192.168.1.1 – 192.168.1.254,
netmask 255.255.255.0, in the private RFC 1918 range.
10.20.30.40/30 — a transit link between two routers:
network 10.20.30.40, broadcast 10.20.30.43,
and exactly two usable addresses, which is all a point-to-point link
needs. 203.0.113.7/32 — a single public host: network,
broadcast, first and last host are all the same address.