IP Subnet Calculator
Calculate an IPv4 network address, broadcast address, subnet mask, wildcard mask, address count and usable host range from an IP address and CIDR prefix.
Binary form
IP:
Mask:
How the IP Subnet Calculator works
The IP Subnet Calculator converts the four IPv4 octets into one unsigned 32-bit value. It builds a subnet mask from the CIDR prefix, applies a bitwise AND operation to obtain the network address, and sets all host bits to one to obtain the broadcast address. The wildcard mask is the bitwise inverse of the subnet mask.
The calculator then converts each 32-bit result back into dotted-decimal notation. It also reports the total address count, conventional usable host count, first and last usable addresses, classful label, private-range status and binary form. Modern routing uses CIDR rather than classful boundaries, so the class label is informational.
IPv4 subnet formulas
For prefix length p, the number of host bits is 32 − p. Total addresses equal 2^(32 − p). For ordinary subnets from /0 through /30, conventional usable hosts equal total addresses minus the network and broadcast addresses.
A /31 contains two addresses and is commonly used for point-to-point links, where both can be treated as endpoints under RFC 3021. A /32 identifies one host route. The calculator handles those two cases separately instead of subtracting two addresses.
Worked example: 192.168.1.130/24
A /24 mask contains 24 network bits and 8 host bits. Its dotted-decimal subnet mask is 255.255.255.0, and the wildcard mask is 0.0.0.255. Applying the mask to 192.168.1.130 gives the network address 192.168.1.0. Setting the eight host bits to one gives 192.168.1.255. The conventional usable range is 192.168.1.1 through 192.168.1.254, providing 254 usable hosts.
CIDR prefixes and subnet masks
CIDR notation appends a slash and the number of leading network bits. A /8 mask is 255.0.0.0, /16 is 255.255.0.0, /24 is 255.255.255.0 and /32 is 255.255.255.255. Increasing the prefix length creates a smaller address block because fewer bits remain for host addresses.
Private IPv4 address ranges
The private ranges defined by RFC 1918 are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are intended for internal networks and are not globally routed on the public internet. Network address translation often maps private addresses to one or more public addresses.
Planning and limitations
Subnet calculations describe address boundaries but do not configure routers, firewalls, DHCP scopes or VLANs. Reserve addresses required by the platform, allow for growth and document assignments. Cloud providers may reserve additional addresses inside each subnet, so their usable count can be lower than the mathematical IPv4 count.
Technical definitions are available from the IETF CIDR specification (RFC 4632) and the private-address specification (RFC 1918).
Why use this IP Subnet Calculator?
This IP Subnet Calculator gives network planning results instantly without manual binary conversion. Use the IP Subnet Calculator to verify IPv4 ranges before documenting or comparing subnets.
Frequently asked questions
What is a subnet mask?
A subnet mask marks the network bits with ones and host bits with zeros. It determines which addresses belong to the same IPv4 subnet.
What is a wildcard mask?
A wildcard mask is the inverse of the subnet mask. Network equipment may use it in access-control and routing configurations.
Is the broadcast address usable?
In conventional /30 and larger IPv4 subnets, the broadcast address is reserved. /31 point-to-point links and /32 host routes are special cases.
Does this calculator support IPv6?
This page focuses on IPv4. IPv6 uses 128-bit addresses and does not use broadcast addresses in the same way.
Why might a cloud subnet offer fewer hosts?
Cloud platforms often reserve addresses for gateways, DNS or platform services. Check the provider’s documentation before allocating workloads.