CIDR Calculator

CIDR Subnet Calculator

Instantaneous IPv4 CIDR prefix decomposition, subnet mask calculation, usable host address range, and bitwise binary diagnostics.

IPv4 Network Parameters
Please enter a valid IPv4 address (e.g. 192.168.1.100, four octets 0–255).
/0 /8 /16 /24 /32
CIDR Notation
192.168.1.0/24
Canonical Network Block
Usable Hosts 99.2%
254 Hosts
Excluding Net ID & Broadcast
Usable IP Range
192.168.1.1 – 192.168.1.254
First to Last Host IP
Subnet Mask
255.255.255.0
Dotted Decimal Bitmask
Subnet Property Value Notes & Bit Specifications
Input IP Address 192.168.1.100 Specified host IP within target subnet
CIDR Network Block 192.168.1.0/24 Canonical routing prefix (base route)
Network Address (ID) 192.168.1.0 All host bits set to 0 (bitwise AND)
Usable Host Range 192.168.1.1 – 192.168.1.254 Network ID + 1 through Broadcast - 1
Broadcast Address 192.168.1.255 All host bits set to 1 (bitwise OR)
Subnet Mask 255.255.255.0 24 leading ones, 8 trailing zeros
Wildcard (Inverse) Mask 0.0.0.255 Used in Cisco ACLs and OSPF network statements
Total IP Addresses 256 2^(32 - 24) = 2^8 total slots
Usable Host Count 254 (99.2% usable) Total slots minus network ID and broadcast
Classful Categorization Class C Traditional classful boundary (192.0.0.0/24)
IP Scope & Classification Private (RFC 1918) Non-routable on public Internet
Integer Representation 3232235876 32-bit unsigned decimal integer
Hexadecimal IP 0xC0A80164 Hex representation (C0.A8.01.64)
Binary IP Address 11000000.10101000.00000001.01100100 Dotted 4-octet 32-bit binary
Binary Subnet Mask 11111111.11111111.11111111.00000000 Dotted 4-octet bitmask binary
32-Bit Octet Architecture & Address Allocation
24 Net Bits
8 Host Bits
Octet 1 (Bits 1–8)
192
1 1 0 0 0 0 0 0
Octet 2 (Bits 9–16)
168
1 0 1 0 1 0 0 0
Octet 3 (Bits 17–24)
1
0 0 0 0 0 0 0 1
Octet 4 (Bits 25–32)
100
0 1 1 0 0 1 0 0
254 /24 Subnet
Usable Host Capacity
254 (99.2%)
Network Identifier Address
1 (0.39%)
Broadcast Address
1 (0.39%)
Total Address Space
256 Addresses
Adjacent Subnet Size Scaling Comparison
/22 255.255.252.0
1,022 hosts
/23 255.255.254.0
510 hosts
/24 255.255.255.0
254 hosts
/25 255.255.255.128
126 hosts
/26 255.255.255.192
62 hosts
Bitwise Calculation Step-by-Step Audit
=== BITWISE CIDR DECOMPOSITION AUDIT === Input IP Address : 192.168.1.100 -> 11000000.10101000.00000001.01100100 Prefix Length : /24 (24 network bits, 8 host bits) Subnet Mask : 255.255.255.0 -> 11111111.11111111.11111111.00000000 Bitwise AND : (IP & MASK) === Network ID Network ID : 192.168.1.0 -> 11000000.10101000.00000001.00000000 Wildcard Mask : 0.0.0.255 -> 00000000.00000000.00000000.11111111 Bitwise OR : (Network | Wildcard) === Broadcast Broadcast IP : 192.168.1.255 -> 11000000.10101000.00000001.11111111 Host Range Calc : 2^(32 - 24) - 2 = 256 - 2 = 254 Usable Hosts
Complete IPv4 CIDR Prefix & Subnet Mask Master Reference (/0 to /32)

This authoritative reference table shows every IPv4 prefix length, the corresponding dotted-decimal subnet mask, wildcard mask, total IP capacity, usable host count, and standard industry applications.

Prefix Subnet Mask Wildcard Mask Total Addresses Usable Hosts Typical Network Scope / Application
/0 0.0.0.0 255.255.255.255 4,294,967,296 4,294,967,294 Default route / Entire Internet (0.0.0.0/0)
/1 128.0.0.0 127.255.255.255 2,147,483,648 2,147,483,646 Half of Internet routing space
/2 192.0.0.0 63.255.255.255 1,073,741,824 1,073,741,822 Large CIDR Supernet
/3 224.0.0.0 31.255.255.255 536,870,912 536,870,910 Large CIDR Supernet
/4 240.0.0.0 15.255.255.255 268,435,456 268,435,454 Large CIDR Supernet
/5 248.0.0.0 7.255.255.255 134,217,728 134,217,726 Large CIDR Supernet
/6 252.0.0.0 3.255.255.255 67,108,864 67,108,862 Large CIDR Supernet
/7 254.0.0.0 1.255.255.255 33,554,432 33,554,430 Large CIDR Supernet
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214 Former Class A network (16.7M hosts)
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606 Class A subnetting
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302 Class A subnetting
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150 Class A subnetting
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574 RFC 1918 Private Class B block (1M hosts)
/13 255.248.0.0 0.7.255.255 524,288 524,286 Class A subnetting
/14 255.252.0.0 0.3.255.255 262,144 262,142 Class A subnetting
/15 255.254.0.0 0.1.255.255 131,072 131,070 Class A subnetting
/16 255.255.0.0 0.0.255.255 65,536 65,534 Former Class B network (65.5K hosts)
/17 255.255.128.0 0.0.127.255 32,768 32,766 Class B subnetting
/18 255.255.192.0 0.0.63.255 16,384 16,382 Class B subnetting
/19 255.255.224.0 0.0.31.255 8,192 8,190 Common Cloud VPC Subnet (8K hosts)
/20 255.255.240.0 0.0.15.255 4,096 4,094 Common Cloud VPC Subnet (4K hosts)
/21 255.255.248.0 0.0.7.255 2,048 2,046 Medium Enterprise Subnet (2K hosts)
/22 255.255.252.0 0.0.3.255 1,024 1,022 Standard Large Department (1,022 hosts)
/23 255.255.254.0 0.0.1.255 512 510 Dual /24 Supernet (510 hosts)
/24 255.255.255.0 0.0.0.255 256 254 Former Class C network (254 hosts)
/25 255.255.255.128 0.0.0.127 128 126 Half Class C subnet (126 hosts)
/26 255.255.255.192 0.0.0.63 64 62 Quarter Class C subnet (62 hosts)
/27 255.255.255.224 0.0.0.31 32 30 Branch office / small VLAN (30 hosts)
/28 255.255.255.240 0.0.0.15 16 14 Small cluster / management subnet (14 hosts)
/29 255.255.255.248 0.0.0.7 8 6 Point-to-Multipoint / ISP WAN link (6 hosts)
/30 255.255.255.252 0.0.0.3 4 2 Traditional Point-to-Point link (2 hosts)
/31 255.255.255.254 0.0.0.1 2 2 RFC 3021 Modern Point-to-Point link (2 hosts)
/32 255.255.255.255 0.0.0.0 1 1 Single Host / Loopback / Route (1 host)
RFC 1918 Private IP Address Spaces & Special Reservations
RFC 1918 Block CIDR Prefix Subnet Mask Address Range Total IPs Classful Equivalent
24-bit block 10.0.0.0/8 255.0.0.0 10.0.0.0 – 10.255.255.255 16,777,216 1 Class A network
20-bit block 172.16.0.0/12 255.240.0.0 172.16.0.0 – 172.31.255.255 1,048,576 16 contiguous Class B networks
16-bit block 192.168.0.0/16 255.255.0.0 192.168.0.0 – 192.168.255.255 65,536 256 contiguous Class C networks

Special-Purpose & Reserved IPv4 Blocks

Address Range CIDR Prefix RFC Standard Designated Purpose
127.0.0.0 – 127.255.255.255 127.0.0.0/8 RFC 1122 Loopback host addresses (localhost)
169.254.0.0 – 169.254.255.255 169.254.0.0/16 RFC 3927 Link-Local Auto-Configuration (APIPA)
100.64.0.0 – 100.127.255.255 100.64.0.0/10 RFC 6598 Carrier-Grade NAT (CGNAT) Shared Address Space
224.0.0.0 – 239.255.255.255 224.0.0.0/4 RFC 5771 Multicast Address Space (Former Class D)
240.0.0.0 – 255.255.255.254 240.0.0.0/4 RFC 1112 Reserved for Future Use (Former Class E)
255.255.255.255 255.255.255.255/32 RFC 919 Limited Broadcast address (local network segment)

Understanding CIDR (Classless Inter-Domain Routing)

Classless Inter-Domain Routing (CIDR, pronounced "cider") was formally introduced in 1993 by the Internet Engineering Task Force (IETF) in RFC 1518 and RFC 1519 to replace the rigid, inefficient classful network architecture developed in the early 1980s. Under original classful routing, IPv4 networks were strictly carved into Class A (/8, 16.7M hosts), Class B (/16, 65,534 hosts), and Class C (/24, 254 hosts). This inflexible allocation led to severe waste: an organization requiring 300 IP addresses could not fit into a Class C network and was allocated a full Class B block, wasting over 65,000 routable public IPv4 addresses.

CIDR solved this crisis by decoupling IP address assignment from byte boundaries. Instead of enforcing octet boundaries, CIDR allows the network prefix length to be specified at any arbitrary bit boundary from /0 to /32. This introduced two transformative architectural capabilities:

  • Variable-Length Subnet Masking (VLSM): Network engineers can subdivide IP spaces into customized subnet sizes tailored precisely to host counts, maximizing address utilization.
  • Route Aggregation (Supernetting): Multiple contiguous network prefixes can be aggregated into a single, compact routing table entry. For example, four contiguous /24 subnets can be advertised to upstream BGP peers as a single /22 supernet, preventing the global Internet routing table from collapsing under exponential route growth.

How to Calculate Subnetting Math by Hand

Every IPv4 address is an unsigned 32-bit binary integer partitioned into two contiguous segments: the Network ID (the high-order $N$ bits) and the Host ID (the remaining $32 - N$ bits). Understanding the mathematical transformations allows engineers to troubleshoot routing tables, firewalls, and cloud VPC configurations with precision:

1. Computing the Subnet Mask

Given prefix length $N$, the subnet mask consists of $N$ consecutive binary 1s followed by $32 - N$ consecutive binary 0s. To calculate the dotted-decimal value for prefix /24:

11111111.11111111.11111111.00000000 = 255.255.255.0

2. Deriving the Network Address via Bitwise AND

The network identifier is extracted by performing a bitwise logical AND operation between the host IP address and the subnet mask. For each bit position, the output bit is 1 if and only if both the IP bit and mask bit are 1. Any bit paired with a mask bit of 0 is zeroed out. For IP 192.168.1.100 and mask 255.255.255.0, the final octet calculation is 100 & 0 = 0, yielding network address 192.168.1.0.

3. Calculating Total and Usable Host Capacities

With $h = 32 - N$ host bits, the total number of unique binary bit patterns is:

$$ ext{Total Addresses} = 2^h = 2^{32 - N}$$

Under standard RFC rules ($N le 30$), two special addresses are reserved in each subnet:

  1. Network Identifier: All host bits set to 0. Used to identify the subnet route in IP forwarding tables.
  2. Directed Broadcast Address: All host bits set to 1. Packets sent to this address are delivered to all nodes on the local link layer.

Consequently, the usable host capacity is calculated using the classic formula:

$$ ext{Usable Hosts} = 2^{32 - N} - 2$$

4. Crucial Subnetting Exceptions: /31 and /32

Modern networking standards incorporate two essential exceptions to the $2^{32 - N} - 2$ rule:

  • RFC 3021 Point-to-Point Links (/31 Prefix): On point-to-point links between two routers, broadcast capability is unnecessary. RFC 3021 allows a /31 subnet mask (2 total addresses) to provide 2 usable host addresses without reserving network or broadcast IDs, conserving millions of IPv4 addresses across core service provider backbones.
  • Host Routes (/32 Prefix): A /32 mask assigns a single IP address with zero host bits ($2^0 = 1$). It is universally deployed for virtual loopback interfaces, BGP router identifiers, container endpoints, and VPN client virtual adapters.

Frequently Asked Questions (FAQ)

The slash notation represents the prefix length, which tells network devices how many contiguous bits from left to right identify the network portion of the 32-bit IPv4 address. For example, /24 means the first 24 bits belong to the network identifier (corresponding to 255.255.255.0), leaving the remaining 8 bits to identify individual host machines on that local network segment.
In standard subnets ($/0$ through $/30$), the first address (where all host bits are binary 0) is reserved as the Network ID to represent the subnet itself in router routing tables. The last address (where all host bits are binary 1) is reserved as the Directed Broadcast Address, allowing a device to transmit a packet to every active host on that subnet simultaneously. This is why standard subnets subtract 2 from total addresses.
A Subnet Mask uses binary 1s to match network bits and binary 0s to represent host bits (e.g., 255.255.255.0). A Wildcard Mask (or inverse mask) is the exact bitwise inversion (bitwise NOT) of the subnet mask: 0s mean "must match exactly", while 1s mean "ignore / wildcard" (e.g., 0.0.0.255). Wildcard masks are widely used in Cisco IOS Access Control Lists (ACLs) and OSPF routing protocol configuration statements.
In traditional on-premises networks, only 2 addresses are reserved per subnet (Network ID and Broadcast). However, major cloud service providers like Amazon Web Services (AWS VPC) and Google Cloud Platform (GCP VPC) reserve 5 addresses in every subnet. In an AWS /24 subnet (256 total IPs), only 251 IPs are usable because AWS reserves: .0 (Network ID), .1 (VPC Router Gateway), .2 (VPC DNS Server), .3 (Future AWS reservation), and .255 (Network Broadcast).
Yes! RFC 3021 officially ratified the use of 31-bit prefixes on IPv4 point-to-point links. Because there are only two devices connected directly over the physical or logical link, directed broadcasts and a separate network identifier are redundant. Modern enterprise and carrier-grade routers (Cisco, Juniper, Arista, Linux) fully support /31, reducing address consumption by 50% compared to legacy /30 links.