CIDR ↔ Subnet Mask Converter

Convert between CIDR notation and subnet mask with visual binary representation

What is CIDR and Subnet Mask Conversion?

CIDR (Classless Inter-Domain Routing) notation and subnet masks are two ways to represent the same network information. CIDR uses a slash followed by a number (like /24) to indicate how many bits are used for the network portion, while subnet masks use dotted decimal notation (like 255.255.255.0). Our converter shows both formats with beautiful visual representations, including color-coded octets, binary breakdowns, and clear network/host bit separation.

/ Enter prefix length (0-32)

Conversion Result

CIDR Notation
/24
Subnet Mask
255.255.255.0
Total Hosts
254

Visual Representation

Decimal Octets
255
255
255
0
Binary Representation
11111111
255
11111111
255
11111111
255
00000000
0
24
Network Bits
8
Host Bits
Network Address
192.168.1.0
Broadcast Address
192.168.1.255
First Host
192.168.1.1
Last Host
192.168.1.254

Understanding CIDR and Subnet Masks

What is a subnet mask and what does it do?

Splitting an IP into network vs. host parts: A subnet mask divides an IP address into two parts - the network portion (like a ZIP code) and the host portion (like a street address).

Example: If you have 192.168.1.x & 255.255.255.0, the "ZIP code" is 192.168.1 and the "address" is the last number.

Routing decisions: The subnet mask tells devices: "If these bits match, the host is local; otherwise use the gateway."

How do I calculate network, broadcast address, and usable hosts?

Network Address: The first address in the subnet (all host bits = 0)

Broadcast Address: The last address in the subnet (all host bits = 1)

Usable Hosts: Total addresses minus 2 (network and broadcast)

Formula: For /26 (6 host bits): 2^6 - 2 = 62 usable hosts

Essential for Network+ certification and configuring home office VLANs.

How many hosts are in this subnet?

Common queries:

  • "How many IPs in /26?" = 64 total, 62 usable
  • "What does 255.255.254.0 give me?" = /23 = 512 total, 510 usable
  • "What mask for 100 hosts?" = Need /25 (126 usable hosts)

Scaling tip: Users often go from /24 to /23 to get 256 more DHCP addresses.

What's the default mask for Class A/B/C?

Class A: 255.0.0.0 or /8 (16.7M hosts)

Class B: 255.255.0.0 or /16 (65,534 hosts)

Class C: 255.255.255.0 or /24 (254 hosts)

These are the traditional "default" subnet masks, though modern networks use CIDR for more flexible subnetting.

CIDR Notation

CIDR (Classless Inter-Domain Routing) uses a slash followed by a number to indicate how many bits are used for the network portion. For example, /24 means the first 24 bits identify the network.

Network vs Host Bits

Network bits (shown in blue) identify the network segment, while host bits (shown in orange) identify individual devices within that network. The boundary determines your subnet size.