IP Subnet Calculator
Calculate network, broadcast, host range and masks from any IPv4 CIDR.
Reviewed by Selim Ataballyev · Last reviewed
Runs 100% in your browser - your data never leaves your device
Type a CIDR like 10.0.0.0/8, or an address plus a prefix or netmask.
What You Should Know
An IP subnet calculator takes an IPv4 address with a prefix length (like 192.168.1.0/24) or a dotted netmask and returns the network address, broadcast address, first and last usable host, host count, netmask, and wildcard mask. All math runs instantly in your browser using 32-bit arithmetic - nothing is sent to a server. It handles every prefix from /0 to /32, including the /31 point-to-point and /32 host-route special cases.
Using the IP Subnet Calculator
- Type a CIDR such as
10.0.0.0/8straight into the address field - the prefix is read from after the slash. - Or enter a plain address like
192.168.1.25and pick a prefix length from the dropdown, or paste a dotted netmask such as255.255.255.0. - Read the results instantly: network address, broadcast address, first and last usable host, host count, netmask, wildcard mask, and the mask in binary.
- Copy any value with its Copy button - useful when filling router configs or firewall rules.
How the Math Works
Every IPv4 address is a 32-bit number. The prefix length splits those bits into a network part and a host part. The calculator builds the netmask by setting the first n bits to 1, then derives everything else with three bitwise operations: network = address AND mask, broadcast = network OR NOT mask, and wildcard = NOT mask. The usable range is the network address plus one through the broadcast address minus one. All of it runs in your browser with unsigned 32-bit arithmetic; no address you type ever leaves the page.
Where Subnet Math Comes Up
- Carving a VPC or office network into smaller subnets and checking how many hosts each /26 or /27 actually holds.
- Writing firewall rules or Cisco ACLs that need the wildcard-mask form instead of the netmask.
- Checking whether two addresses are in the same subnet before debugging a "no route to host" error.
- Planning point-to-point router links with /31 prefixes to avoid burning four addresses per link.
- Translating between the prefix notation used in cloud consoles and the dotted masks expected by legacy equipment.
Edge Cases the Tool Handles
- /31 - treated per RFC 3021: two usable addresses, no broadcast, flagged with a note.
- /32 - a single host route; network and broadcast do not apply.
- /0 - the default route matching all 4.3 billion addresses.
- Non-contiguous masks such as 255.0.255.0 are rejected with an error instead of producing nonsense.
- Address scope is identified automatically: RFC 1918 private ranges, loopback, link-local, carrier-grade NAT, or public.
Frequently Asked Questions
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) writes an address and its network size together: 192.168.1.0/24 means the first 24 bits identify the network and the remaining 8 bits identify hosts. It replaced the old class A/B/C system in 1993 (RFC 1519) because fixed class boundaries wasted enormous address blocks. The /24 suffix is the prefix length, and it maps directly to a netmask: /24 is 255.255.255.0.
How is the number of usable hosts calculated?
For a prefix length of /30 or shorter, usable hosts = 2^(32 - prefix) - 2. The two subtracted addresses are the network address (all host bits zero) and the broadcast address (all host bits one). A /24 therefore has 2^8 - 2 = 254 usable hosts. The exceptions: /31 links have exactly 2 usable addresses (RFC 3021 drops network/broadcast on point-to-point links), and a /32 is a single host route.
What is a wildcard mask and where is it used?
A wildcard mask is the bitwise inverse of the netmask: 255.255.255.0 inverts to 0.0.0.255. Cisco ACLs and OSPF network statements use wildcard masks instead of netmasks, with 0 bits meaning "must match" and 1 bits meaning "ignore". This calculator shows both so you can copy whichever form your configuration syntax expects.
Why does a /31 subnet have no broadcast address?
RFC 3021 allows /31 prefixes on point-to-point links precisely because there are only two parties, so directed broadcast is meaningless. Both addresses in the pair are assigned to interfaces. Routers from all major vendors support this; it halves the address cost of point-to-point links compared to the traditional /30.
Does this tool support IPv6?
Not in this version - it is IPv4-only. IPv6 prefix math is conceptually identical (a /64 splits the 128-bit address into network and interface halves) but the numbers need 128-bit arithmetic and the output format differs enough that it deserves its own tool.
Is my IP address sent anywhere when I use this?
No. The calculator is a small Preact component that does all the bit arithmetic locally with 32-bit unsigned operations. There is no fetch call, no lookup service, and no logging of what you type. You can verify this in DevTools: the Network tab stays silent while you type.
How do I convert a netmask like 255.255.240.0 to a prefix length?
Count the consecutive 1 bits from the left: 255.255.240.0 in binary is 11111111.11111111.11110000.00000000, which is 20 ones, so it equals /20. This tool does the conversion automatically when you type a dotted mask in the netmask field - and it rejects non-contiguous masks like 255.0.255.0, which are invalid for subnetting.