100% client-side · no IP leaves your browser

Subnet Calculator

Free IPv4 & CIDR subnet calculator. Enter an IP and prefix to instantly get the network address, broadcast address, usable host range, wildcard mask, total hosts, and CIDR↔subnet-mask conversion.

Input 🖥️ IP & Subnet

/24
Drag to change the prefix length. The mask updates automatically.

Result 📊 Subnet Details

Network Address
Broadcast Address
First Usable Host
Last Usable Host
Subnet Mask
Wildcard Mask
CIDR Notation
Total Addresses
Usable Hosts
IP Class
Type
Binary Mask

Tip: click any value above to copy it to your clipboard.

The fastest way to do IPv4 subnetting

This subnet calculator turns the tedious binary arithmetic of IPv4 subnetting into a single glance. Enter any IPv4 address and a CIDR prefix (or its dotted-decimal subnet mask), and the tool instantly returns the network address, broadcast address, the first and last usable host, the wildcard mask, the total and usable host counts, and the address class. Everything runs locally in your browser, so no IP address, hostname, or network plan ever leaves your machine — ideal for working on production infrastructure where confidentiality matters.

How IPv4 subnetting works

An IPv4 address is a 32-bit number, usually written as four 8-bit octets in dotted decimal (for example 192.168.1.10). A subnet mask splits those 32 bits into a network portion (the leading 1 bits) and a host portion (the trailing 0 bits). CIDR (Classless Inter-Domain Routing) notation writes the mask as a slash followed by the count of network bits, so /24 means the first 24 bits are network and the last 8 are host.

prefix = number of leading 1 bits in the mask
total addresses = 2 ^ (32 − prefix)
usable hosts = 2 ^ (32 − prefix) − 2  (for prefix ≤ 30)
network = IP AND mask
broadcast = network OR (NOT mask)

The network address is what you get when you keep the network bits and set every host bit to 0 (a bitwise AND of the IP and the mask). The broadcast address sets every host bit to 1 (a bitwise OR of the network and the inverted mask). Every address strictly between those two is a usable host address that you can assign to a device.

Worked example: 192.168.1.10 /26

A /26 mask is 255.255.255.192 — 26 network bits and 6 host bits, giving 2^6 = 64 addresses per subnet. The address 192.168.1.10 falls in the first block (192.168.1.0192.168.1.63). So:

Change the prefix to /27 and each subnet shrinks to 32 addresses (30 usable); change it to /25 and it grows to 128 addresses (126 usable). The slider above lets you feel that trade-off in real time.

CIDR to subnet mask reference table

The most common prefixes and their dotted-decimal masks and host counts:

CIDRSubnet MaskWildcardTotalUsable Hosts
/30255.255.255.2520.0.0.342
/29255.255.255.2480.0.0.786
/28255.255.255.2400.0.0.151614
/27255.255.255.2240.0.0.313230
/26255.255.255.1920.0.0.636462
/25255.255.255.1280.0.0.127128126
/24255.255.255.00.0.0.255256254
/23255.255.254.00.0.1.255512510
/22255.255.252.00.0.3.25510241022
/16255.255.0.00.0.255.2556553665534
/8255.0.0.00.255.255.2551677721616777214

Common use cases

/31 and /32 special cases

Per RFC 3021, a /31 subnet has just two addresses and both are usable as host addresses on point-to-point links — there is no separate network or broadcast address, which conserves scarce IPv4 space on router links. A /32 describes a single host (a host route), commonly seen on loopback interfaces and in routing tables. This calculator handles both correctly instead of reporting "0 usable hosts".

Why use a client-side subnet calculator?

Because subnet math involves the literal addressing of your infrastructure, sending it to a third-party server is an unnecessary risk. This tool computes everything with JavaScript in your browser — it works offline once loaded, returns answers with zero network latency, and never logs your inputs. It is part of the DevCalc hub of free, privacy-first developer calculators.

Subnet Calculator FAQ

What is a subnet calculator?+
A subnet calculator takes an IPv4 address and a CIDR prefix (or subnet mask) and computes the network address, broadcast address, usable host range, wildcard mask, and the number of hosts in the subnet. It removes the manual binary math from IPv4 subnetting.
How do I convert CIDR to a subnet mask?+
The CIDR prefix is the number of leading 1 bits in the 32-bit mask. /24 means 24 ones followed by 8 zeros = 255.255.255.0. /16 = 255.255.0.0 and /8 = 255.0.0.0. This calculator converts both directions automatically.
How many usable hosts are in a /24?+
A /24 has 256 total addresses (2^8). Two are reserved (network and broadcast), leaving 254 usable host addresses. The formula is 2^(32 - prefix) total and 2^(32 - prefix) - 2 usable, except /31 and /32 which are special cases.
What is the difference between a /31 and /30 subnet?+
A /30 has 4 addresses with 2 usable, common for point-to-point links. A /31 (RFC 3021) has only 2 addresses and both are usable for point-to-point links, with no separate network or broadcast address. A /32 represents a single host route.
What is a wildcard mask?+
A wildcard mask is the bitwise inverse of the subnet mask. For 255.255.255.0 the wildcard is 0.0.0.255. Wildcard masks are used in Cisco ACLs and OSPF network statements to match a range of addresses.
Is this subnet calculator free and private?+
Yes. The subnet calculator is completely free with no signup. All calculation happens entirely in your browser using JavaScript — no IP address or data is ever sent to a server.