IP Subnet Calculator
Network, broadcast, and host range from any prefix.
IP Subnet Calculator
Turn an IPv4 address and prefix into its network, broadcast, usable range, and subnet mask.
Four octets, 0–255. Host bits can be set; the tool masks them off.
24 is a typical LAN, 30 a point-to-point link, 32 a single host.
192.168.1.0/24
- Subnet mask
- 255.255.255.0
- Wildcard mask
- 0.0.0.255
- Usable host range
- 192.168.1.1 – 192.168.1.254
- Broadcast
- 192.168.1.255
- Usable hosts
- 254
- Total addresses
- 256
A /31 is treated as a point-to-point link with two usable addresses; a /32 is a single host. This tool handles IPv4 only.
Embed this calculator
Put this calculator on your own site with the snippet below. The frame contains the tool only, reports its own height, and carries a visible link back to the full page. Embedding is free; keep the attribution link as it is, and do not wrap the frame in a way that hides it.
Preparing the embed code for this page...
What This Calculator Does
The IP Subnet Calculator takes an IPv4 address and prefix length and returns the network address, subnet mask, wildcard mask, broadcast address, first and last usable host, and how many hosts fit. It is the arithmetic behind every subnetting question, done without a lookup table.
How It Works
The address is converted to a 32-bit integer. The mask has the first prefix bits set to one and the rest to zero, so a bitwise AND keeps only the network bits. Broadcasting sets every host bit to one. The usable range excludes the network and broadcast addresses, except for /31 point-to-point links and /32 single hosts.
Example
For 192.168.1.10/24 the mask is 255.255.255.0, so the network is 192.168.1.0 and the broadcast is 192.168.1.255. Usable hosts run from 192.168.1.1 to 192.168.1.254 — 254 of the 256 addresses. A /30 leaves just two usable hosts on a 10.0.0.4 network.
Formula
Network = IP AND maskBroadcast = Network OR (NOT mask)Hosts = 2^(32 − prefix) − 2The −2 removes the network and broadcast addresses. /31 and /32 are special-cased.
Reading the Results
Network address
The first address in the block, with all host bits cleared. It identifies the subnet and is not assignable to a host.
Usable host range
The addresses you can actually assign. The network and broadcast addresses are excluded because they have special meanings on the link.
Wildcard mask
The bitwise inverse of the subnet mask, used by access control lists and routing protocols to match address ranges.
Sources and References
RFC 950 — Internet Standard Subnetting Procedure
Subnet masks and the network/broadcast convention
Defines subnetting and reserves the all-zeros and all-ones host values.
RFC 4632 — Classless Inter-domain Routing (CIDR)
Prefix-length notation and aggregation
CIDR replaced classful addressing with the /n prefix notation used here.
References identify the method or data behind this calculator. Where a standard or tariff changes, the current edition applies, and the assumptions stated above take precedence over a remembered figure.
Frequently Asked Questions
How many usable hosts does a /24 have?
A /24 contains 256 addresses. Subtracting the network and broadcast addresses leaves 254 usable hosts. The general rule is 2 to the power of the host bits, minus two.
Why does a /31 have two usable addresses?
RFC 3021 allows /31 for point-to-point links, where there is no need for a network or broadcast address. Both addresses can be assigned, which is why the usual minus-two rule does not apply.
What is the difference between a subnet mask and a wildcard mask?
A subnet mask has ones for the network bits and zeros for hosts. A wildcard mask is the exact inverse: zeros where the address must match and ones where it can vary. Cisco ACLs use wildcard masks.
Does this work for IPv6?
No. This calculator is IPv4-only because the arithmetic and host conventions differ substantially in IPv6. Entering 128-bit notation will be rejected rather than silently mis-computed.
