Netmask to CIDR Converter

Convert subnet masks between dotted-decimal notation (255.255.255.0) and CIDR prefix notation (/24). Bi-directional conversion with instant results.

Netmask to CIDR
Result:
/24
CIDR to Netmask
/
Result:
255.255.255.0

Additional Details

Wildcard Mask: 0.0.0.255
Total Addresses: 256
Usable Hosts: 254
Binary Representation:
11111111.11111111.11111111.00000000
Complete Conversion Reference
CIDR Netmask Wildcard Hosts

What is Netmask to CIDR Conversion?

Netmask to CIDR conversion transforms subnet masks between two equivalent notations. The dotted-decimal format (like 255.255.255.0) expresses the mask as four octets, while CIDR notation (like /24) simply counts the number of network bits. Both represent the same information – the division between network and host portions of an IP address.

Different network devices and documentation use different formats. Windows typically displays subnet masks in dotted-decimal, while Linux often uses CIDR notation. Cloud platforms like AWS exclusively use CIDR. Being able to convert between formats is essential for network administrators working across different systems. For complete subnet calculations, use our subnet calculator.

Quick Conversion Tip

The CIDR number equals the count of 1 bits in the binary representation. 255.255.255.0 = 11111111.11111111.11111111.00000000 = 24 ones = /24. Memorize common conversions: /8 = 255.0.0.0, /16 = 255.255.0.0, /24 = 255.255.255.0.

How the Conversion Works

Netmask to CIDR

To convert a subnet mask to CIDR, convert each octet to binary and count the total 1 bits. For 255.255.255.192: 255 = 8 ones, 255 = 8 ones, 255 = 8 ones, 192 = 2 ones. Total: 8+8+8+2 = 26, so the CIDR is /26.

CIDR to Netmask

To convert CIDR to netmask, create a 32-bit binary number with that many leading 1s, then convert each 8-bit group to decimal. For /26: 26 ones followed by 6 zeros = 11111111.11111111.11111111.11000000 = 255.255.255.192.

Common Conversions Reference

CIDR Netmask Addresses Common Use
/8255.0.0.016,777,216Class A default
/16255.255.0.065,536Class B default
/24255.255.255.0256Class C / Standard LAN
/25255.255.255.128128Half /24
/26255.255.255.19264Quarter /24
/27255.255.255.22432Small subnet
/28255.255.255.24016Very small subnet
/30255.255.255.2524Point-to-point link
/32255.255.255.2551Single host

Valid Subnet Mask Values

Not all combinations of numbers make valid subnet masks. Each octet can only contain specific values that represent consecutive 1 bits:

  • 0 = 00000000 (0 bits)
  • 128 = 10000000 (1 bit)
  • 192 = 11000000 (2 bits)
  • 224 = 11100000 (3 bits)
  • 240 = 11110000 (4 bits)
  • 248 = 11111000 (5 bits)
  • 252 = 11111100 (6 bits)
  • 254 = 11111110 (7 bits)
  • 255 = 11111111 (8 bits)

Additionally, once an octet is less than 255, all following octets must be 0. For example, 255.255.240.0 is valid, but 255.240.255.0 is not. The converter validates your input and reports invalid masks. For more details on subnet masks, see our subnet mask calculator.

Wildcard Mask

The wildcard mask is the bitwise inverse of the subnet mask. It's used in Cisco ACLs and OSPF configuration. This converter also shows the wildcard mask for convenience. For example, netmask 255.255.255.0 has wildcard 0.0.0.255. Our wildcard mask calculator provides additional wildcard functionality.

Where Each Format is Used

Dotted-Decimal (Netmask)

  • Windows network configuration
  • Many router interface configurations
  • DHCP server settings
  • Legacy documentation

CIDR Notation

  • Linux network configuration
  • AWS, Azure, GCP cloud platforms
  • Routing table displays
  • Modern documentation and diagrams
  • Firewall rules

For detailed CIDR block analysis, use our CIDR calculator. To see all IP addresses in a range, try our CIDR to IP range calculator.

Frequently Asked Questions

Dotted-decimal notation predates CIDR and was used with classful addressing. CIDR notation was introduced in 1993 to support classless routing and is more compact. Both persist because different systems and vendors adopted different standards. Windows traditionally uses dotted-decimal while Unix/Linux and modern cloud platforms prefer CIDR.

A valid subnet mask must have all 1 bits contiguous from the left, followed by all 0 bits. In dotted-decimal, this means each octet can only be 0, 128, 192, 224, 240, 248, 252, 254, or 255. Also, once an octet is less than 255, all following octets must be 0. Examples of invalid masks: 255.255.100.0, 255.0.255.0, 255.255.255.1.

Start with the class defaults: /8 = 255.0.0.0, /16 = 255.255.0.0, /24 = 255.255.255.0. Then learn the last-octet values: .128=/25, .192=/26, .224=/27, .240=/28, .248=/29, .252=/30. The pattern is each adds one bit: 128+64=192, 192+32=224, etc. Practice with the reference table until common values become automatic.

Related Network Tools

Looking to calculate subnets for your network? You can also explore CIDR prefix notation. For detailed analysis, calculate subnet mask values. Network administrators often need to find wildcard masks from subnet masks. Additionally, translate decimal IPs to binary. Many users find it helpful to confirm IP address correctness. For comprehensive planning, view subnet structures interactively.