CIDR Calculator

Calculate CIDR network ranges.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter an IPv4 address in CIDR notation and get the network address, subnet mask, broadcast address, first and last usable host and the number of hosts. The address you type does not need to be the network address.

How to use

1
Step 1
Enter an address with a prefix, such as 192.168.1.0/24.
2
Step 2
Press Run.
3
Step 3
Read the range and host count.

How it works

The prefix length says how many leading bits are the network part. The mask is those bits set to 1. The network address is the IP ANDed with the mask, the broadcast is the network with all host bits set to 1, and the usable hosts run from network + 1 to broadcast − 1. A /24 has 2^8 − 2 = 254 usable hosts.

usable hosts = 2^(32 − prefix) − 2

Worked example

A /28 from a host address

Input
10.1.2.77/28
Output
{ "network": "10.1.2.64", "prefix": 28, "mask": "255.255.255.240", "broadcast": "10.1.2.79", "firstHost": "10.1.2.65", "lastHost": "10.1.2.78", "hostCount": 14 }
Walkthrough
A /28 spans 16 addresses in blocks of 16. 77 falls in the block starting at 64, so the network is.64 and the broadcast is.79; 14 are usable.

Limitations

  • IPv4 only; IPv6 prefixes are not supported.
  • /31 (a point-to-point link) reports both addresses as hosts and /32 reports a single host, so the usable-host formula above applies to /30 and larger blocks.
  • The prefix must be a whole number from 0 to 32, and octets with leading zeros such as 010 are rejected.
  • The address is not checked for being private or public.

Questions

How many hosts are in a /24?
254 usable addresses (256 minus the network and broadcast addresses).
What is the subnet mask for /28?
255.255.255.240.
How do I find the network address from an IP and prefix?
AND the IP with the mask. The tool does this and shows it as network.
Does CIDR 10.0.0.0/8 work?
Yes, it gives network 10.0.0.0, mask 255.0.0.0 and 16,777,214 hosts.

Features

  • Network, broadcast, range
  • Usable host count
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Learn JSON - Full Crash Course

    freeCodeCamp.org

    JSON is the payload format behind many developer tools here.

    Watch on YouTube
  • What Is A RESTful API?

    Traversy Media

    API context for JWT, JSON, and encoding utilities.

    Watch on YouTube
  • web.dev

    Google

    Modern web guidance that pairs with encoding and tooling pages.

  • MDN Web Docs

    MDN

    Primary reference for web APIs these developer tools touch.