DevToolPal
EN

Subnet Calculator (IPv4 CIDR)

Calculate network and broadcast addresses, host range, host count, netmask and wildcard from a CIDR or IP and mask, and split a network into subnets.

Runs locally, never uploaded

Options

IP address and mask

Result

Result appears here

What it does

The subnet calculator takes an IPv4 address with a prefix length (CIDR notation, like 192.168.1.10/24) or with a dotted subnet mask (192.168.1.10 255.255.255.0) and works out everything about the network it belongs to: the network address, broadcast address, first and last usable host, number of addresses and usable hosts, subnet mask, wildcard mask, address class and whether the address is private or public. A binary view shows exactly which bits belong to the network and which to the host. Everything is calculated in your browser; nothing is sent anywhere.

How to use

  1. Type an address into the box. These forms all work: 10.0.0.1/8, 10.0.0.1 255.0.0.0, 10.0.0.1/255.0.0.0 and a wildcard mask such as 10.0.0.1 0.255.255.255. An address without a mask is treated as a single host (/32).
  2. The results update as you type. Click Copy next to any value.
  3. To plan a network, pick a number under Split into subnets. The network is divided into that many equal subnets (rounded up to a power of two), and each one is listed with its host range and broadcast address. The Copy button above the list copies it as tab-separated text you can paste into a spreadsheet.
  4. For IPv6, enter something like 2001:db8:abcd::/48.

Example

192.168.1.10/24
Network      192.168.1.0
Broadcast    192.168.1.255
Hosts        192.168.1.1 – 192.168.1.254 (254)

Splitting the same /24 into 4 subnets gives four /26 networks with 62 hosts each, starting at 192.168.1.0, .64, .128 and .192.

How the math works

An IPv4 address is a 32-bit number. The prefix length says how many of the leading bits identify the network; the remaining bits identify the host. The subnet mask is those network bits set to 1. AND-ing the address with the mask gives the network address, and setting all host bits to 1 gives the broadcast address. Each extra bit of prefix halves the network, which is why a /25 has 128 addresses and a /26 has 64.

Address classes (A to E) come from the first octet and are shown for reference only. Routing has been classless (CIDR) since the 1990s, so the prefix length, not the class, decides how big a network is.

FAQ

› How many usable hosts does a subnet have?

A subnet with prefix /n has 2^(32 − n) addresses. Two of them, the network address and the broadcast address, cannot be assigned to hosts, so a /24 has 256 addresses and 254 usable hosts. The exceptions are /31, where both addresses are usable on a point-to-point link (RFC 3021), and /32, which is a single host.

› What is a wildcard mask?

It is the subnet mask with every bit inverted, so 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks. You can type either form here; the calculator recognizes a wildcard mask and converts it.

› How do I tell whether an IP address is private?

The private ranges from RFC 1918 are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The Type row shows this, and also flags loopback, link-local, CGNAT (100.64.0.0/10), documentation, multicast and reserved addresses.

› Does it work with IPv6?

Yes, for the basics. Enter an address with an optional prefix such as 2001:db8::/48 to get the compressed and expanded forms, the first and last address of the prefix, the number of addresses and the address type. You can split IPv6 prefixes too. IPv6 has no broadcast address, so no addresses are subtracted.