IP Subnet Calculator - CIDR, Mask & Host Range
Enter an IPv4 address and CIDR prefix to get the network and broadcast address, subnet and wildcard mask, usable host range, and host count — with correct /31 and /32 handling, computed in your browser.
Configuration
Subnet Details
The first address is the network ID and the last is the broadcast address, so usable hosts = total − 2.
The prefix is just a line drawn through 32 bits
An IPv4 address is 32 bits. The CIDR prefix says how many of those bits, counting from the left, belong to the network; the rest identify the host. A /24 reserves the first 24 bits for the network and leaves 8 for hosts, which is why a /24 holds 28 = 256 addresses. Move the line one bit right to /25 and you halve the block to 128 addresses; move it left to /23and you double it to 512. Every question this tool answers — network address, broadcast, host range, mask — comes from where that single line sits.
The subnet mask is the same line expressed as an address: 24 leading one-bits followed by 8 zero-bits is 11111111.11111111.11111111.00000000, which reads as 255.255.255.0. That is all a mask is — the network/host boundary written in dotted-decimal so a router can apply it with a single bitwise AND. This is also why masks only ever contain the values 0, 128, 192, 224, 240, 248, 252, 254, and 255: those are the only bytes you get from a run of ones followed by a run of zeros.
Why the network address is rarely the address you typed
This is the single most common surprise. Enter 192.168.1.100 with a /27 and the network address comes back as 192.168.1.96, not 192.168.1.100. Nothing is wrong. A /27 leaves 5 host bits, so subnets step every 25 = 32 addresses: the boundaries are .0, .32, .64, .96, .128, and so on. The address .100 lives inside the block that starts at .96, so that is its network address, and the broadcast is .127— the last address before the next block begins at .128.
The tool does this snapping on purpose. In practice you rarely know a subnet’s network address off the top of your head, but you always know an address some device is using — a router interface, a printer, a DHCP lease. Paste that in and the calculator tells you which subnet it belongs to and what the usable range around it is. Feeding it the exact network ID is optional, not required.
Sizing a subnet to a device count
The usable-host count is 2(32 − prefix) − 2 for any prefix from /0 to /30. Round up to the next prefix that fits:
- /24 — 256 total, 254 usable
- /25 — 128 total, 126 usable
- /26 — 64 total, 62 usable
- /27 — 32 total, 30 usable
- /28 — 16 total, 14 usable
- /29 — 8 total, 6 usable
- /30 — 4 total, 2 usable
A network of exactly 30 hosts needs a /27: a /28’s 14 usable addresses fall short, and you cannot borrow the two reserved ones.
The /31 and /32 special cases
The − 2 rule breaks down at the two smallest prefixes, and older calculators get this wrong by reporting 0 usable hosts:
- /31 — 2 usable hosts. RFC 3021 allows both addresses on a point-to-point link, since a two-endpoint link needs no broadcast. Routers use
/31s for the links between them to avoid wasting half a/30. - /32 — 1 usable host. A single-address route, used for loopback interfaces, host routes, and firewall or ACL rules that match exactly one address.
This calculator reports 2 and 1 for these prefixes, with no broadcast address, rather than the textbook 0.
What this tool does not do
It calculates a single IPv4 subnet from one prefix. It does not do variable-length subnet masking (VLSM) across a plan — carving a /24 into a mix of /26s and /28s for departments of different sizes is a design exercise you drive one block at a time. It does not calculate IPv6 subnets, which follow different rules with a 128-bit address and no broadcast concept at all. And it does not check whether your chosen block overlaps something already in use — overlapping CIDR ranges between on-premises networks, VPN gateways, and cloud VPCs are a real source of routing failures, but detecting them needs the whole address plan, not one subnet.
For the one job it does, the arithmetic is exact and deterministic: bitwise masking on a 32-bit integer, computed in your browser, with the full /0–/32range handled without the integer-overflow errors that plague naive implementations. Use it to check a boundary, size a block, or settle a “which subnet is this address in” question in seconds — then verify against your actual routing tables before you deploy.
How to Use
Enter an IPv4 address such as 192.168.1.100. It does not have to be the network address — the tool finds it for you.
Set the CIDR prefix with the number field or the slider (0 to 32).
Read the network address, broadcast address, subnet and wildcard mask, and the usable host range.
Check the total and usable host counts, then note the line explaining how those counts were derived for this prefix.
Features
Common Questions
About Subnet Calculator
Enter any IPv4 address and CIDR prefix to get the network address, broadcast address, subnet mask, wildcard mask, usable host range, and total and usable host counts. It snaps a host address down to its network boundary automatically, so you can paste an address a device actually uses instead of the network ID. Host counting follows the standards: /0 through /30 reserve the network and broadcast addresses (usable = total minus 2), while /31 is treated as an RFC 3021 point-to-point link with 2 usable hosts and /32 as a single-host route with 1 — not the textbook 0. The full /0 to /32 range is handled without integer overflow, and every calculation runs in the browser with no network or IP data leaving the page.
Also known as: ip subnet, cidr calculator, subnet mask calculator, network calculator, cidr to subnet mask, network and broadcast address, usable host range, wildcard mask calculator, slash 24 subnet, slash 30 subnet, slash 31 point to point, hosts per subnet, vlsm helper, ip range from cidr.
Processing Note
Subnet Calculator runs in your browser, so the input you enter is processed locally on this page and is not uploaded to a ToolMintX account.
Tool Limits
IT tools provide quick diagnostics and transformations. They cannot see every private network, deployment setting, proxy, firewall, or production edge case.
Explore More
AI VRAM Calculator
Estimate GPU VRAM for LLM inference and training using model, quantization, users, and context length.
Client-sideAI API Cost Calculator
Compare and estimate AI API costs across OpenAI, Claude, Gemini, DeepSeek and more for text, image, video, and embeddings.
Client-sideAPI Key and .env Secret Generator
Generate secure .env secrets plus selectable Hugging Face, OpenAI, JWT, database, and webhook variables.
Client-sideIPv4 to IPv6 Converter
Convert an IPv4 address into its IPv4-mapped IPv6 form, 6to4 prefix, and mixed notation, in canonical RFC 5952 hex.
Client-side