Skip to main content

CIDR: Calculate IP Ranges, Subnets & Masks


CIDR Calculator: Calculate IP Ranges, Subnets & Masks


Computer networks are built on math. Every time you connect a device to the internet, you are assigned an IP address. But that address isn't random—it belongs to a specific block of addresses called a Subnet.

Managing these blocks requires understanding a system called CIDR (Classless Inter-Domain Routing).

To the untrained eye, 192.168.1.0/24 looks like nonsense.
But to a network engineer, that little /24 explains everything: exactly how many devices can connect, where the network starts, where it ends, and which mask to use.

A CIDR Calculator is the tool that cracks this code. It instantly translates confusing CIDR notation into usable IP ranges, or converts a range of IPs into the correct CIDR format.

Whether you are configuring an AWS VPC, setting up a home router, or blocking a range of spam IPs on your firewall, this tool is your map to the network.

What Is a CIDR Calculator?

A CIDR Calculator is a utility that performs complex binary math to manage IP address allocation. It typically has two main functions:

1. CIDR to IP Range

You enter a CIDR block (e.g., 10.0.0.0/20).
The calculator tells you:

  • Start IP: 10.0.0.0

  • End IP: 10.0.15.255

  • Total Hosts: 4,096 IP addresses.

  • Netmask: 255.255.240.0

2. IP Range to CIDR

You enter a start and end IP (e.g., 192.168.0.0 to 192.168.0.255).
The calculator tells you the simplest notation: 192.168.0.0/24.

It eliminates the need to manually calculate binary bits, preventing critical configuration errors that could knock a network offline.

Why Does CIDR Exist? (The Problem It Solves)

Before 1993, the internet used a rigid "Classful" system (Class A, B, C).

  • Class A networks were too huge (16 million addresses).

  • Class C networks were too small (256 addresses).

This was wasteful. If a company needed 500 addresses, they would be forced to take a Class B network (65,000 addresses), wasting over 64,000 IPs.

CIDR (Classless Inter-Domain Routing) fixed this by allowing networks to be cut into any size. Instead of "Small, Medium, Large," you can now order a network of exactly the size you need—whether that is 4 IPs, 1,000 IPs, or 500,000 IPs.

How to Read CIDR Notation

CIDR notation is just an IP address followed by a slash and a number between 0 and 32.
Example: 192.168.1.0/24

  • The IP (192.168.1.0): The starting address of the network.

  • The Suffix (/24): The number of bits that are "locked" for the network ID.

The "Slash" Cheat Sheet

The number after the slash tells you how large the network is.

  • /32 = 1 IP (A single specific device)

  • /30 = 4 IPs (Used for point-to-point links)

  • /24 = 256 IPs (Standard home/office network)

  • /16 = 65,536 IPs (Large corporate network)

  • /8 = 16.7 Million IPs (Huge ISP block)

Rule of Thumb: As the number gets smaller, the network gets bigger.
A /20 is much larger than a /24.

Common CIDR Use Cases

1. Cloud Infrastructure (AWS / Azure / GCP)

When you create a Virtual Private Cloud (VPC) in AWS, the first thing it asks for is a CIDR block (e.g., 10.0.0.0/16).

  • If you choose a block that is too small, you will run out of IP addresses for your servers.

  • If you choose overlapping blocks, you won't be able to connect your networks later.

  • A CIDR calculator is mandatory for planning these architectures.

2. Firewalls and Security

If you are being attacked by a spammer from 123.45.67.89 and 123.45.67.90, you don't want to ban them one by one. You want to ban their entire block.
A calculator can tell you that 123.45.67.0/24 covers all 256 addresses owned by that spammer, allowing you to block them all with one rule.

3. Home Networking

Most home routers default to 192.168.1.0/24. This gives you addresses from 192.168.1.1 to 192.168.1.254.
If you try to change your subnet mask to 255.255.0.0 (a /16), you are telling the router to manage 65,000 addresses, which might break things if not configured correctly.

How the Calculation Works (The Math)

The "Slash" number represents the Subnet Mask in binary.
An IPv4 address has 32 bits (1s and 0s).

Example: /24

  • This means the first 24 bits are set to 1.

  • Binary: 11111111.11111111.11111111.00000000

  • Decimal Mask: 255.255.255.0

  • Remaining bits for hosts: 8 bits ($32 - 24 = 8$).

  • Total IP addresses: $2^8 = 256$.

Example: /20

  • This means the first 20 bits are 1.

  • Remaining bits for hosts: 12 bits ($32 - 20 = 12$).

  • Total IP addresses: $2^{12} = 4,096$.

Limitations and "Usable" IPs

A common mistake beginners make is assuming they can use all the IPs in a block.
You cannot.

In every CIDR block, 2 addresses are reserved:

  1. Network Address (First IP): Identifies the network itself (e.g., 192.168.1.0).

  2. Broadcast Address (Last IP): Used to talk to everyone on that network (e.g., 192.168.1.255).

Real-World Example:
If you have a /24 network (256 IPs), you can only connect 254 devices.

  • Formula: Usable IPs = Total IPs - 2.

Note: AWS and Azure reserve 3 extra IP addresses for their own routing, meaning you lose 5 IPs total per subnet in the cloud.

Frequently Asked Questions (FAQ)

What is the difference between Subnet Mask and CIDR?

They are the same thing, just written differently.

  • Subnet Mask: 255.255.255.0

  • CIDR: /24
    CIDR is shorter and easier to type, which is why it is the modern standard.

How do I calculate a CIDR for a range of IPs?

If you have a range like 10.0.0.1 to 10.0.0.50, it doesn't fit perfectly into one CIDR block. A calculator will break it down into multiple blocks, likely:

  • 10.0.0.1/32

  • 10.0.0.2/31

  • 10.0.0.4/30

  • 10.0.0.8/29

  • 10.0.0.16/27

  • 10.0.0.48/31

  • 10.0.0.50/32
    This is why manually calculating ranges is difficult without a tool.

What is the smallest CIDR block I can have?

A /32 represents a single IP address. This is often used in firewall rules to whitelist exactly one computer.

What is the largest CIDR block?

A /0 represents the entire internet (0.0.0.0/0). This is often used in routing tables as the "Default Route"—meaning "send traffic here if you don't know where else to send it."

Can CIDR be used for IPv6?

Yes! IPv6 uses the exact same /number logic, but because IPv6 addresses are 128 bits long, the numbers are much larger (e.g., /48, /64). A standard IPv6 subnet is almost always /64.

Why does AWS ask for a /16 VPC but /24 subnets?

It is standard practice to create a large "container" (the VPC, e.g., /16 with 65k IPs) and then slice it up into smaller chunks (Subnets, e.g., /24 with 256 IPs) for different teams or applications.


Comments

Popular posts from this blog

IP Address Lookup: Find Location, ISP & Owner Info

1. Introduction: The Invisible Return Address Every time you browse the internet, send an email, or stream a video, you are sending and receiving digital packages. Imagine receiving a letter in your physical mailbox. To know where it came from, you look at the return address. In the digital world, that return address is an IP Address. However, unlike a physical envelope, you cannot simply read an IP address and know who sent it. A string of numbers like 192.0.2.14 tells a human almost nothing on its own. It does not look like a street name, a city, or a person's name. This is where the IP Address Lookup tool becomes essential. It acts as a digital directory. It translates those cryptic numbers into real-world information: a city, an internet provider, and sometimes even a specific business name. Whether you are a network administrator trying to stop a hacker, a business owner checking where your customers live, or just a curious user wondering "what is my IP address location?...

Rotate PDF Guide: Permanently Fix Page Orientation

You open a PDF document and the pages display sideways or upside down—scanned documents often upload with wrong orientation, making them impossible to read without tilting your head. Worse, when you rotate the view and save, the document opens incorrectly oriented again the next time. PDF rotation tools solve this frustration by permanently changing page orientation so documents display correctly every time you open them, whether you need to rotate a single misaligned page or fix an entire document scanned horizontally. This guide explains everything you need to know about rotating PDF pages in clear, practical terms. You'll learn why rotation often doesn't save (a major source of user frustration), how to permanently rotate pages, the difference between view rotation and page rotation, rotation options for single or multiple pages, and privacy considerations when using online rotation tools. What is PDF Rotation? PDF rotation is the process of changing the orientation of pages...

QR Code Guide: How to Scan & Stay Safe in 2026

Introduction You see them everywhere: on restaurant menus, product packages, advertisements, and even parking meters. Those square patterns made of black and white boxes are called QR codes. But what exactly are they, and how do you read them? A QR code scanner is a tool—usually built into your smartphone camera—that reads these square patterns and converts them into information you can use. That information might be a website link, contact details, WiFi password, or payment information. This guide explains everything you need to know about scanning QR codes: what they are, how they work, when to use them, how to stay safe, and how to solve common problems. What Is a QR Code? QR stands for "Quick Response." A QR code is a two-dimensional barcode—a square pattern made up of smaller black and white squares that stores information.​ Unlike traditional barcodes (the striped patterns on products), QR codes can hold much more data and can be scanned from any angle.​ The Parts of a ...