Subnet Mask Converter: Prefix, Dotted Mask, Wildcard and Host Count

Open Tool Subnet Mask Converter

Four notations, one object

Prefix 24 sets the first 24 bits to one, the dotted mask 255.255.255.0 writes those same bits in decimal, the wildcard 0.0.0.255 inverts them, and the host count 254 is 2 to the 8th minus 2. Each implies the other three. Wildcards appear mostly in access control lists, whose semantics are inverted: zero means must match and one means any, the opposite of a mask.

Steps

  1. Enter 24, 255.255.255.0 or 0.0.0.255 in the single field; the type is detected.
  2. Click Convert for prefix, dotted mask, wildcard, usable hosts and total addresses.
  3. Example loads a standard value, Download saves it and Clear resets.

Why masks must be contiguous ones

A mask extracts network bits. If ones and zeros interleave, there is no clean network portion, routing cannot compute and the value is invalid by standard. Hand-typing something like 255.255.255.010 makes most systems refuse the config or behave unpredictably. The tool checks binary contiguity, so an invalid warning means a typo rather than an algorithm bug.

Why subtract two from the host count

A /24 holds 256 addresses, and the network and broadcast addresses cannot go to devices, leaving 254. That is IPv4's rule, not conservatism. /31 and /32 are exceptions: the former uses both addresses on point-to-point links under RFC 3021, the latter serves one host or a virtual IP. Apply the formula, then handle those two cases separately, or you will conclude that zero hosts are usable.

Common conversion errors

Entering a wildcard as a mask is the usual one: 0.0.0.255 looks like the prefix-24 mask but is its complement, yielding prefix 0. Mixing decimal and hex, as in FF.FF.FF.00, defeats some tools. Dropping the last octet, as in 255.255.255, gets parsed as a three-part number. Counting the dots before typing saves most of these failures.

⏫︎