subnet mask calculator

Provide either CIDR prefix or subnet mask. If both are given, they must match.

What this subnet mask calculator does

This subnet mask calculator helps you quickly break down an IPv4 network into the details you actually need: network address, broadcast address, usable host range, wildcard mask, and host capacity. Instead of manually converting bits and counting boundaries, you can enter an IP and either a CIDR prefix (like /24) or a dotted-decimal subnet mask (like 255.255.255.0) and get a complete result instantly.

How to use the calculator

  1. Enter an IPv4 address (for example: 10.20.30.40).
  2. Enter either a CIDR prefix (such as 16) or a subnet mask (such as 255.255.0.0).
  3. Click Calculate to view the full subnet breakdown.

If you enter both CIDR and subnet mask, the calculator validates that they represent the same network mask. This helps avoid common configuration mistakes in routers, firewalls, DHCP scopes, and cloud networking interfaces.

Understanding subnet masks and CIDR

Subnet mask basics

A subnet mask defines which portion of an IPv4 address belongs to the network and which portion belongs to hosts. In binary terms, 1s indicate network bits and 0s indicate host bits.

Example: 255.255.255.0 equals /24, meaning the first 24 bits are network bits.

CIDR notation

CIDR (Classless Inter-Domain Routing) is a compact way to write masks. Instead of writing 255.255.254.0, you write /23. CIDR makes subnetting easier to read and reduces ambiguity when planning VPCs, VLANs, and routing policies.

Wildcard mask

The wildcard mask is the inverse of the subnet mask. It is widely used in ACLs (access control lists), especially on network devices. For example:

  • Subnet mask: 255.255.255.0
  • Wildcard mask: 0.0.0.255

Common subnet reference

CIDR Subnet Mask Total Addresses Usable Hosts*
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422 (point-to-point)
/32255.255.255.25511 (single host)

*Traditional usable host count excludes network and broadcast addresses for masks /30 and larger host pools.

Practical networking tips

  • Plan for growth: choose a subnet that leaves headroom for future devices.
  • Document ranges: keep track of gateway, DHCP pools, and static assignments.
  • Avoid overlap: overlapping subnets break routing and VPN connectivity.
  • Use private IP ranges correctly: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are private.

FAQ

What is the difference between /24 and 255.255.255.0?

They are equivalent. /24 is CIDR notation; 255.255.255.0 is dotted-decimal mask notation.

Why are /31 and /32 special?

/31 is often used for point-to-point links (both addresses can be used). /32 refers to a single host route or interface address.

Can I use this for IPv6?

This calculator is for IPv4 subnetting. IPv6 uses prefix lengths too, but the address structure and best practices are different.

🔗 Related Calculators