IP Range Calculator
Work out the first and last address of a CIDR block, and how many addresses the range contains.
Inputs
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
Values used
IPv4 address = 192.168.10.37; Prefix length (CIDR) = 26 bits
IP Range
first = IP AND mask, last = first OR NOT(mask), total = 2^(32 − p).
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
How it works
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
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.