Network & IP Calculation Tools

Subnet Mask Calculator

Enter a prefix from /0 to /32 or a dotted-decimal subnet mask to convert in either direction and validate bit continuity.

Accepts /0 through /32, 0 through 32, and dotted-decimal masks with contiguous bits.

Convert between CIDR prefixes and subnet masks, with strict validation that the binary 1s and 0s are contiguous.

Your input is processed only in your browser and is never uploaded to a server.

What this tool does

The Subnet Mask Calculator uses one field for two-way prefix-to-mask and mask-to-prefix conversion. A mask must not only contain four octets from 0 to 255; its full 32-bit form must also consist of consecutive 1 bits followed by consecutive 0 bits.

  • The boundary values 0.0.0.0 (/0) and 255.255.255.255 (/32) are both supported.
  • Values such as 255.255.127.0 may look close to valid but are rejected because their mask bits are not contiguous.
  • The wildcard mask, network bits, host bits, and total address count are also displayed.

How to use it

  1. Enter /26, 26, or 255.255.255.192.
  2. Click Convert Prefix / Mask.
  3. View the corresponding prefix, mask, and 32-bit binary representation.
  4. Copy the complete conversion result.

How it works

A valid 32-bit mask must match 1*0*: once a 0 appears, no later bit may be 1. The prefix length is the number of contiguous leading 1s, and the wildcard mask is the bitwise inverse of the subnet mask.

Examples

  • /26 → 255.255.255.192, Wildcard 0.0.0.63, 64 addresses total.
  • 255.255.254.0 → /23.
  • 255.0.255.0 → Invalid because the binary pattern contains 1→0→1.

Common uses

  • Convert between CIDR notation and dotted-decimal masks for routing configurations.
  • Validate that a manually entered subnet mask is contiguous.
  • View the host bits and address capacity for a prefix.

Privacy

Inputs and results are processed only in local browser memory. Nothing is uploaded, sent to an online API, or stored automatically.

Subnet Mask Calculator Features

Convert between CIDR prefixes and subnet masks, with strict validation that the binary 1s and 0s are contiguous. Useful for network planning, configuration checks, and troubleshooting; results can be reviewed and copied immediately.

FAQ

What CIDR prefix corresponds to 255.255.255.0?

It contains 24 consecutive 1 bits, so it is equivalent to /24.

What is the subnet mask for /26?

/26 corresponds to 255.255.255.192 and leaves 6 host bits.

Why is 255.0.255.0 not a valid subnet mask?

Its full binary form contains a 1 after a 0, which violates the contiguous-mask rule.

What is a wildcard mask?

It is the bitwise inverse of the subnet mask and is commonly used in ACLs and network-matching expressions.

Back to Developer Tools