Skip to content
Toolzent

IP Subnet Calculator

Free IPv4 subnet calculator. Enter an IP and CIDR prefix to get the network address, broadcast, subnet mask, wildcard mask, usable host range, and host count.

Updated 2026-06-14 · Free · No sign-up · Runs privately in your browser

Network address
Broadcast address
Subnet mask
Wildcard mask
Usable host range
Usable hosts
Show the formula & steps

How the IP Subnet Calculator Works

This calculator breaks down any IPv4 network. Enter an IP address and a CIDR prefix (the number after the slash), and it returns the network address, broadcast address, subnet mask, wildcard mask, the usable host range, and the number of usable hosts. All values are computed with exact 32-bit integer arithmetic in your browser.

The Formula

Subnetting is pure bitwise math on the 32-bit address:

Subnet mask = the first prefix bits set to 1, the rest 0 Network = IP AND mask Broadcast = network OR (NOT mask) Usable hosts = 2^(32 − prefix) − 2 (for prefixes /0 to /30)

The ”− 2” removes the network and broadcast addresses, which cannot be assigned to hosts. A /31 reserves nothing (2 usable addresses for point-to-point links), and a /32 represents a single host.

Worked Example

Take 192.168.1.130/26:

  • Prefix /26 → mask = 255.255.255.192, wildcard = 0.0.0.63
  • Network = 192.168.1.130 AND 255.255.255.192 = 192.168.1.128
  • Broadcast = network OR wildcard = 192.168.1.191
  • Usable range = 192.168.1.129 – 192.168.1.190
  • Usable hosts = 2^(32−26) − 2 = 64 − 2 = 62
PropertyValue
Network192.168.1.128/26
Broadcast192.168.1.191
Subnet mask255.255.255.192
Wildcard mask0.0.0.63
Usable range192.168.1.129 – 192.168.1.190
Usable hosts62

Common Prefix Sizes

CIDRMaskTotal addressesUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242

Why Subnetting Matters

Dividing a network into subnets controls how many devices share a broadcast domain, improves security through segmentation, and conserves address space. Network engineers use subnet calculations constantly when planning IP ranges, configuring routers and firewalls, and writing access control lists, so knowing the network, broadcast, and host range for a given prefix is a core skill.

Frequently asked questions

How does a subnet calculator work?+

It converts the IPv4 address and CIDR prefix to 32-bit numbers, builds the subnet mask by setting the first prefix bits to 1, then uses bitwise AND with the mask to find the network address and OR with the wildcard to find the broadcast. From those it derives the usable host range and host count.

How many usable hosts are in a subnet?+

For prefixes up to /30, usable hosts = 2^(32 - prefix) - 2, because the network and broadcast addresses are reserved. A /24 has 2^8 - 2 = 254 usable hosts, and a /26 has 2^6 - 2 = 62. A /31 has 2 usable addresses (RFC 3021 point-to-point) and a /32 has 1.

What is the difference between the network and broadcast address?+

The network address is the first address in the subnet (all host bits 0) and identifies the subnet itself. The broadcast address is the last address (all host bits 1) and is used to send to every host on the subnet. Neither can be assigned to an individual device on a normal subnet.

What is a wildcard mask?+

A wildcard mask is the bitwise inverse of the subnet mask: where the mask has 1s the wildcard has 0s and vice versa. For a /26 the mask is 255.255.255.192 and the wildcard is 0.0.0.63. Wildcard masks are used in access control lists and OSPF to match ranges of addresses.

What does the CIDR prefix mean?+

The CIDR prefix (the number after the slash, such as /24) is how many leading bits of the address are the network portion. A larger prefix means a smaller subnet with fewer hosts; a smaller prefix means a larger subnet. /24 leaves 8 host bits for 256 addresses, while /26 leaves 6 host bits for 64 addresses.