IP Range Calculator
Work out the first and last address of a CIDR block, and how many addresses the range contains.
About IP Range Calculator
Masking the address clears every host bit, which lands on the first address of the block. ORing that with the inverted mask sets every host bit, giving the last address. The count is simply two raised to the number of host bits. Firewall rules, DHCP exclusions and cloud security groups are written as ranges, so translating a prefix into explicit bounds prevents rules that overlap or leave gaps.
Formula
IP Range
first = IP AND mask, last = first OR NOT(mask), total = 2^(32 − p).
- p
- CIDR prefix length
- mask
- Subnet mask derived from p
Worked example
With the default values below, IP Range Calculator returns Address Range of 192.168.10.0 – 192.168.10.63. Change any input above and every figure here is recalculated in your browser.
Inputs used
- IPv4 address
- 192.168.10.37
- Prefix length (CIDR)accepts 0–32 bits
- 26 bits
Results
- Address Range
- 192.168.10.0 – 192.168.10.63
- First Address
- 192.168.10.0
- Last Address
- 192.168.10.63
- Total Addresses
- 64
Step by step
- 1Values used
- 2IP Range
- 3Address Range= 192.168.10.0 – 192.168.10.63
- 4First Address= 192.168.10.0
- 5Last Address= 192.168.10.63
- 6Total Addresses= 64
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is IP Range calculated?
first = IP AND mask, last = first OR NOT(mask), total = 2^(32 − p). Masking the address clears every host bit, which lands on the first address of the block. ORing that with the inverted mask sets every host bit, giving the last address. The count is simply two raised to the number of host bits.
Why does IP Range matter?
Firewall rules, DHCP exclusions and cloud security groups are written as ranges, so translating a prefix into explicit bounds prevents rules that overlap or leave gaps.
What values do I need to enter?
This calculator takes 2 inputs: IPv4 address, Prefix length (CIDR). The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
