01

Two masks, one bit pattern

An IPv4 subnet mask is 32 bits: a run of ones marking the network portion, then a run of zeros marking the host portion. The inverse mask — also called a wildcard mask or one's complement — flips every bit, so the network bits become zeros and the host bits become ones.

The conversionsubnet 255.255.255.0 = 11111111 11111111 11111111 00000000
wildcard 0.0.0.255 = 00000000 00000000 00000000 11111111

The two forms carry the same information. Which one you write depends on the device: routers and interface configuration use the subnet mask, while Cisco access control lists and OSPF statements use the wildcard mask.

02

Prefix length and host count

The number of leading ones is the CIDR prefix length, written /24 for 255.255.255.0. The number of host bits is 32 minus the prefix, and the number of addresses in the block is 2 raised to that power.

Common prefixes
Subnet maskPrefixWildcardAddressesUsable hosts
255.255.255.252/300.0.0.342
255.255.255.248/290.0.0.786
255.255.255.240/280.0.0.151614
255.255.255.192/260.0.0.636462
255.255.255.0/240.0.0.255256254
255.255.0.0/160.0.255.25565 53665 534
255.0.0.0/80.255.255.25516 777 21616 777 214

Usable hosts is two fewer than the address count because the first address identifies the network and the last is the broadcast address. The /31 and /32 cases are exceptions: /31 supports two point-to-point endpoints, and /32 is a single host route with no network or broadcast address at all.

The wildcard counts what is free. Read the wildcard as "this many values may vary". For /24 the last octet may be anything from 0 to 255, so the wildcard is 0.0.0.255 — exactly the range of the host portion.

03

Where wildcard masks are required

  • ACLs — a Cisco access list entry matches an address range using a wildcard: 192.168.1.0 0.0.0.255 means the whole /24.
  • OSPF network statements — the area statement takes a wildcard, so 10.0.0.0 0.255.255.255 puts every 10.x address in the area.
  • EIGRP — same convention as OSPF for network statements.
  • Some firewall rules — vendor syntax varies, so always check whether the field expects a mask or a wildcard.

The classic mistake is entering a subnet mask where a wildcard is expected. On an ACL, 192.168.1.0 255.255.255.0 does not mean "the /24 network" — it matches almost nothing, because it requires the first three octets to differ from 192.168.1 in every bit.

04

Contiguity is not optional

A valid subnet mask has all its ones before all its zeros. Any other pattern still has a well-defined complement, but routers will reject it, because the prefix-length notation it implies cannot be expressed as a single CIDR block.

For example 255.0.255.0 is not a legal mask: its binary form interleaves ones and zeros. The tool computes the complement anyway — that is what a bitwise NOT does — but it flags the pattern as non-contiguous so you know the value will not work on real equipment.

Legal versus illegal patterns
MaskBinary (first 24 bits)Contiguous?Verdict
255.255.255.011111111 11111111 11111111YesValid /24
255.255.254.011111111 11111111 11111110YesValid /23
255.0.255.011111111 00000000 11111111NoRejected by routers
05

Working from binary

The tool also accepts a binary mask, which is useful when you are reading a configuration dump or a packet capture. A short string like 11110000 is padded on the right to 32 bits, since a mask written as a prefix of ones implicitly has zeros after it.

If you are converting by hand, remember that each octet is independent. 255 becomes 0, 0 becomes 255, and a partial octet such as 192 (11000000) becomes 63 (00111111). Adding the two octets always gives exactly 255 — a quick check that catches most arithmetic slips.

?

Frequently asked questions

What is the inverse of 255.255.255.0?

0.0.0.255. Flipping every bit turns the three 255 octets into zeros and the final 0 into 255. This is the wildcard mask for a /24 network.

Why does a /24 have 254 usable hosts and not 256?

The block contains 256 addresses, but the lowest is the network address and the highest is the broadcast address. Neither can be assigned to a host, leaving 254.

Is a wildcard mask the same as an inverted subnet mask?

For standard contiguous masks, yes — it is exactly the one's complement. Access lists use it as a matching pattern, which is a slightly different job, but the arithmetic is identical.

What does 0.0.0.0 as a mask mean?

A subnet mask of 0.0.0.0 is a /0, matching every address. Its wildcard is 255.255.255.255, meaning every bit may vary — the default route in mask form.

What about 255.255.255.255?

That is a /32, a single host. Its wildcard is 0.0.0.0, meaning no bits may vary. It appears in host routes and in ACL entries that match one specific address.

Why does the tool warn about non-contiguous masks?

Because a mask with interleaved ones and zeros cannot be written as a prefix length, so routing protocols and most configuration interfaces will refuse it. The complement is still computable, but it is not usable as a mask.