CIDR subnet calculator
Network, mask, broadcast and usable addresses of an IPv4 block.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
In short
- What it calculates
- Network, mask, broadcast and usable addresses of an IPv4 block.
- Formula used
Mask = 32 − prefix bits set to zero- Example
- For 192.168.1.0/24:
IPv4 CIDR subnet calculator
CIDR notation compresses into one number how many bits of the address identify the network. From that come the mask, the usable range and how many machines fit.
It is the everyday operation of anyone segmenting a network.
How it works
The prefix determines the mask. The network address comes from a logical AND between the IP and the mask, and the broadcast from filling the host bits with ones.
Formula
Mask = 32 − prefix bits set to zero
Hosts = 2^(32 − prefix) − 2
Worked example
For 192.168.1.0/24:
Mask: 255.255.255.0
Range: 192.168.1.1 – 192.168.1.254
Usable hosts: 254
Explanation
Two addresses in every network cannot be assigned
The first identifies the network itself and the last is the broadcast address, used to reach all hosts at once. That is why a network with a twenty-four bit mask has 256 addresses but only 254 usable. It is the reason the arithmetic never comes out round.
Each mask bit halves the network
Going from a twenty-four to a twenty-five bit mask splits the network into two equal halves. From twenty-five to twenty-six, into four. That progression is the key to dividing a range into subnets of the size you need without wasting addresses.
Special cases
A thirty-two bit mask designates a single address, used for routes to one specific host. The thirty-one bit mask is reserved for point-to-point links, where no network or broadcast address is needed because there are only two ends.
Private ranges
There are three blocks reserved for internal use that are never routed on the internet: one large class A, sixteen class B networks and 256 class C. They appear in every office and home, which is why local addresses usually start with 192.168.
Frequently asked questions
Why are two addresses subtracted?
Because the first identifies the network and the last is the broadcast address. Neither can be assigned to a machine.
What about /31 and /32?
They are special cases: /31 is used on point-to-point links with two usable addresses, and /32 designates a single host.
Why does a /24 network have 254 hosts and not 256?
Because the first address identifies the network and the last is the broadcast address. Neither can be assigned to a host.
What is a /31 mask for?
For point-to-point links between two devices, where network and broadcast addresses are unnecessary and both available addresses can be used.
Need to calculate something else?
These tools are often used alongside this calculator.
Base converter
Convert numbers between bases 2, 8, 10, 16, 32 and 36.
Data
Bytes, kilobytes, megabytes, gigabytes and terabytes, decimal and binary.
Timestamp
Convert between Unix timestamps and readable UTC dates.
UUID
Random unique identifiers ready for databases and APIs.
Passwords
Random passwords with calculated entropy, generated in your browser.
Base64
Turn text into Base64 and recover the original text.