Subnet Mask Validator
Check mask structure and contiguity.
Subnet Mask Validator: inputs and results
Enter an IP address, CIDR prefix, or range. Then check its first and last address below.
Calculated Boundaries & ParametersReady
Key Capabilities
- •100% Client-Side: Zero telemetry or server latency.
- •RFC Compliant: Exact 32-bit and 128-bit integer precision.
- •Quick Copy: Instant access to CIDR, mask, and range bounds.
- •Cross-Platform: Works on desktop, tablet, and mobile browsers.
Related Masks, Wildcards & ACLAll Tools
IP Address and Mask Calculator
Calculate the corresponding network range.
CIDR to Subnet Mask Converter
Convert IPv4 prefixes to dotted masks.
Subnet Mask to CIDR Converter
Find prefix length from contiguous masks.
Subnet Mask to Wildcard Converter
Calculate the inverse IPv4 mask.
Wildcard Mask to Subnet Mask Converter
Convert compatible contiguous wildcard masks.
ACL Wildcard Match Calculator
Evaluate address-and-wildcard matching.
How Subnet Mask Validator Works?
The Subnet Mask Validator works by checking 3 properties of a mask: 4 octets, every octet from 0 to 255, and all 1 bits placed before all 0 bits.
Enter a mask
Type a value such as
255.255.255.250.Check the format
The mask must have exactly 4 decimal octets.
Check the octet range
Every octet must be between 0 and 255.
Check contiguity
The validator inverts the mask and adds 1. A valid mask produces an exponent of 2.
255.255.255.250inverts to 5, and 5 + 1 = 6 fails.
Subnet Mask Validator Formula
The Subnet Mask Validator formula is Valid = ((NOT Mask) AND ((NOT Mask) + 1)) = 0, which is true only for contiguous masks.
Inverse
I = NOT M = 2^32 − 1 − MThe wildcard as an integer.
Contiguity test
(I AND (I + 1)) = 0True when I is a run of 1 bits on the right.
Valid octet values
{0, 128, 192, 224, 240, 248, 252, 254, 255}Any other octet value fails.
Worked example: 255.255.255.250
250 = 11111010 Inverse last octet = 00000101 = 5 5 AND 6 = 00000101 AND 00000110 = 4 ≠ 0 Result = Invalid (non-contiguous 1 bits)
Subnet Mask Validator Conversion Table
The Subnet Mask Validator conversion table checks 12 sample masks and shows the result and reason or prefix for each.
| Mask | Binary | Result | Reason / Prefix |
|---|---|---|---|
| 255.255.255.0 | 11111111.11111111.11111111.00000000 | Valid | /24 |
| 255.255.0.255 | 11111111.11111111.00000000.11111111 | Invalid | Non-contiguous 1 bits |
| 255.255.255.250 | 11111111.11111111.11111111.11111010 | Invalid | Non-contiguous 1 bits |
| 255.255.255.256 | — | Invalid | Octet above 255 |
| 0.0.0.0 | 00000000.00000000.00000000.00000000 | Valid | /0 |
| 255.255.255.255 | 11111111.11111111.11111111.11111111 | Valid | /32 |
| 255.0.255.0 | 11111111.00000000.11111111.00000000 | Invalid | Non-contiguous 1 bits |
| 255.255.128.0 | 11111111.11111111.10000000.00000000 | Valid | /17 |
| 255.255.192.1 | 11111111.11111111.11000000.00000001 | Invalid | Non-contiguous 1 bits |
| 255.254.0.0 | 11111111.11111110.00000000.00000000 | Valid | /15 |
| 255.255.255.253 | 11111111.11111111.11111111.11111101 | Invalid | Non-contiguous 1 bits |
| 255.255.255 | — | Invalid | Not 4 decimal octets |
What is Subnet Mask Validator?
The Subnet Mask Validator is a tool that checks whether a dotted-decimal value is a valid IPv4 subnet mask. A valid mask has 1 bits on the left and 0 bits on the right with no gaps.
RFC 950 permitted non-contiguous masks, but RFC 4632 and every modern implementation require contiguous masks. Devices reject masks such as 255.0.255.0, or worse, accept them and route unpredictably.
Typos are the main source of invalid masks: 255.255.255.250 instead of 255.255.255.252, or 255.255.225.0 instead of 255.255.224.0. The validator catches each one with a clear reason.
What are the uses of Subnet Mask Validator?
There are 4 main uses of the Subnet Mask Validator, including form validation, config audits, and typo detection.
Validating form fields
Web forms for network settings reject invalid masks before saving.
Auditing device configurations
Audit scripts flag interfaces with non-contiguous or mistyped masks.
Catching typos in tickets
Change tickets with
255.255.225.0fail validation before implementation.Teaching mask structure
Students learn why only 9 octet values appear in valid masks.