Subnet Calculator
Network address, broadcast address, mask and usable hosts for any IPv4 address and CIDR.
How it works
Enter an IPv4 address and a prefix length. The tool gives the network and broadcast address, the mask, the wildcard mask, the first and last usable host and the number of hosts.
The formula
hosts = 2^(32 - prefix) - 2
Worked example
192.168.1.10/24: network 192.168.1.0, broadcast 192.168.1.255, 254 usable hosts from .1 to .254.
Good to know
- A /31 is for point-to-point links and a /32 is a single host, so the minus 2 rule does not apply to them.
- The network address is the address AND the mask.
- 192.168.x.x, 10.x.x.x and 172.16 to 172.31 are private ranges.
Common questions
- Why minus 2?
- The first address names the network and the last is the broadcast.
- What is a wildcard mask?
- The inverse of the subnet mask, used in router access lists.
- Does it do IPv6?
- No.
More in CS Labs & Coding.
Watch 10 sorting algorithms animate step by step with live counters and pseudocode, or race them on the same input.
CS Labs & CodingTOP PICKGraph Algorithm VisualizerTOP PICKDraw your own graph and watch BFS, DFS, Dijkstra, Bellman-Ford, Prim, Kruskal, topological sort and more run step by step, with the queue, the distance table and the reason for every move.
Big-O Estimator from TimingsTime your code on a few input sizes, paste the numbers, and see which growth rate fits best.
OPEN →