Network · Developer

Subnet calculator.

Enter an IPv4 address with a CIDR prefix (192.168.1.10/24) or a subnet mask. Get the network address, broadcast address, first and last usable host, wildcard mask, binary view, class, and private or public type — plus a table that splits the block into smaller subnets and handles the /31 and /32 special cases.

Advertisement

Inputs

Result

Enter an address and prefix, then press Calculate.

Advertisement

Subnet mask cheat sheet: /0 to /32

Every IPv4 prefix length with its subnet mask, wildcard mask, total addresses and usable hosts. For /0 to /30 usable hosts = total − 2; /31 and /32 follow the RFC 3021 and single-host rules described below. Also available as a standalone subnet mask cheat sheet.

CIDRSubnet maskWildcard maskTotal addressesUsable hosts
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/3224.0.0.031.255.255.255536,870,912536,870,910
/4240.0.0.015.255.255.255268,435,456268,435,454
/5248.0.0.07.255.255.255134,217,728134,217,726
/6252.0.0.03.255.255.25567,108,86467,108,862
/7254.0.0.01.255.255.25533,554,43233,554,430
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

How it's calculated

The CIDR prefix sets how many leading bits of the 32-bit address are the network portion. The subnet mask is that many 1-bits followed by 0-bits; the network address is the IP with the host bits zeroed out; the broadcast address is the IP with the host bits all set to 1. For most prefixes (/0–/30), the network and broadcast addresses are reserved, so usable hosts = total addresses − 2. The wildcard mask is the bitwise inverse of the subnet mask.

Two prefixes are special. A /31 subnet (2 addresses) has no reserved network or broadcast address at all — RFC 3021 states plainly that "the two addresses... MUST be interpreted as host addresses," making both usable on a point-to-point link. A /32 is a single host route: one address, one usable host.

Type and class. The type column checks the address against the private ranges in RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and the other special-purpose blocks in the IANA registry described by RFC 6890 (loopback, link-local, shared address space, documentation, multicast, reserved). Anything not in one of those blocks is shown as public. The A/B/C/D/E class is shown for reference only; CIDR (RFC 4632) replaced classful addressing, so the class does not decide the subnet mask.

Splitting. Dividing a block into N subnets borrows log2(N) bits from the host portion. N is rounded up to the next power of two, so 5 subnets becomes 8.

Sources (retrieved 2026-10): RFC 4632 (classless inter-domain routing (CIDR)); RFC 3021 (31-bit prefixes on IPv4 point-to-point links); RFC 1918 (address allocation for private internets); RFC 6890 (special-purpose IP address registries); RFC 6598 (100.64.0.0/10 shared address space); RFC 3927 (IPv4 link-local addresses); RFC 5737 (IPv4 documentation address blocks); RFC 5771 (IPv4 multicast address assignments); RFC 791 (Internet Protocol (original address classes)).

Advertisement

Frequently asked questions

How do I calculate a subnet?

Write the address as address/prefix, for example 192.168.1.10/24. Keep the first 24 bits to get the network address (192.168.1.0), set the remaining host bits to 1 to get the broadcast address (192.168.1.255), and the usable hosts are everything in between (192.168.1.1 to 192.168.1.254).

What is the difference between the subnet mask and the wildcard mask?

The subnet mask marks network bits with 1 and host bits with 0. The wildcard mask is its exact bitwise complement: host bits are 1, network bits are 0. For /24 the mask is 255.255.255.0 and the wildcard is 0.0.0.255.

Why does a /31 show 2 total addresses and 2 usable hosts?

RFC 3021 removes the usual network/broadcast reservation for this prefix length — both of its 2 addresses are valid host addresses, which matters for point-to-point links where you would otherwise waste half of the addresses on reservations. A /32 is a single host route with 1 usable address.

Which addresses are private?

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private use. RFC 6598 additionally sets aside 100.64.0.0/10 as shared address space for carrier-grade NAT; it is neither ordinary private nor public space.

Does this work for IPv6?

No, this page is IPv4 only. Use the IPv6 subnet calculator for 128-bit prefixes.

Pure arithmetic — no network access

This tool performs standard IPv4 subnet arithmetic entirely in your browser. It does not look anything up, and it doesn't check whether an address or subnet is actually routed, reachable, or assigned to anyone.