IP Subnet Calculator
Calculate subnet details from CIDR or dotted-mask notation.
/24 — Class C
Net: 11000000.10101000.00000001.00000000
Mask: 11111111.11111111.11111111.00000000
Subnet Layout Grid
Visualizing address space partitions for /24 (256 total IPs)
How subnet calculation works
CIDR (Classless Inter-Domain Routing) notation expresses an IP range as an IP address plus a prefix length — e.g. 192.168.1.0/24. The prefix (/24) is the subnet mask in bits: /24 = 255.255.255.0. You can also enter the mask in dotted decimal: 192.168.1.0 255.255.255.0. The calculator derives network address (IP & mask), broadcast (network | ~mask), first/last usable hosts, total host count, hex representations, IP type (private/public/loopback), and the reverse DNS delegation zone. For networking tools, also try Random IP Generator or Common Ports Reference.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Working out the network, broadcast and host range for a CIDR block.
- Checking whether an address falls inside a given subnet.
- Converting a prefix length to a dotted mask.
- Planning a split of a block into smaller subnets.
- Deriving the mask, network and broadcast from a prefix in one pass.
Frequently Asked Questions
- What input formats are accepted?
- CIDR notation such as `192.168.1.0/24`, or an address and dotted-decimal mask separated by whitespace. A mask is converted to a prefix length by counting leading one-bits and rejected if those bits are not contiguous — `255.255.0.255` is not a valid mask.
- Why do /31 and /32 report no wasted addresses?
- Because the usual network-and-broadcast pair does not apply. A /32 is a single host route, and RFC 3021 allows a /31 to carry two usable addresses on a point-to-point link where a broadcast address has no meaning. Subtracting two would report zero hosts on both.
- Is /0 a valid prefix here?
- Yes. It is the default route and the calculator handles it specially, because JavaScript takes shift counts modulo 32 — so `0xffffffff << 32` evaluates to `0xffffffff` rather than 0, and a naive contiguity check rejects the one mask that is entirely zero bits.
- What does the address-type field tell me?
- Whether the address is loopback, RFC 1918 private space, link-local APIPA, multicast, limited broadcast, or globally routable. It is a quick sanity check that the block you are about to hand out is the kind of block you meant.
- How do I read the reverse-DNS zone it shows?
- It is the `in-addr.arpa` zone whose boundary matches your prefix — one octet for /8 or shorter, two for /16, three below that. Classless delegation for a prefix that is not on an octet boundary needs the RFC 2317 `CNAME` scheme instead.
- Why are classes A, B and C still shown?
- Classful addressing was superseded by CIDR in 1993, but the class ranges still appear in exam questions, vendor documentation, and older equipment defaults. The value is informational — the prefix length is what actually determines the network.
Common errors and gotchas
- Counting the network and broadcast addresses as usable hosts, which for IPv4 they are not.
- Off-by-one on the prefix, where a /24 and a /25 differ by half the range.
- Assuming a mask can have gaps, when a valid one is a run of ones then zeros.
- Treating a /31 or /32 as invalid, when both have defined uses.
- Applying IPv4 host arithmetic to IPv6, where the conventions differ entirely.