CIDR Calculator with IP Range to CIDR and IPv6
Calculate subnets from CIDR, convert IP ranges to CIDR blocks and masks to prefixes, IPv4 and IPv6
| CIDR | 192.168.1.0/24 | |
| Network address | 192.168.1.0 | |
| Broadcast address | 192.168.1.255 | |
| First usable host | 192.168.1.1 | |
| Last usable host | 192.168.1.254 | |
| Usable hosts | 254 | |
| Total addresses | 256 | |
| Subnet mask | 255.255.255.0 | |
| Wildcard mask | 0.0.0.255 | |
| IP range | 192.168.1.0 - 192.168.1.255 | |
| Class / scope | C · Private (RFC 1918) |
IP 11000000.10101000.00000001.00000000 Mask 11111111.11111111.11111111.00000000 Network 11000000.10101000.00000001.00000000
The first 24 bits are the network part; the remaining 8 bits number the hosts.
Smallest exact cover: 2 blocks
- 10.0.0.0/24
- 10.0.1.0/25
How CIDR notation and the subnet calculator work
CIDR (Classless Inter-Domain Routing) writes a network as an address plus a prefix length, such as 192.168.1.0/24. The prefix says how many leading bits identify the network; the rest number the hosts. A /24 leaves 8 host bits, so it spans 2^8 = 256 addresses, from 192.168.1.0 to 192.168.1.255. Its subnet mask is the prefix written as an address, 255.255.255.0, and the wildcard mask used by Cisco ACLs and OSPF is the inverse, 0.0.0.255.
Type any IPv4 address with a prefix (10.20.30.40/20), with a dotted mask (10.20.30.40 255.255.240.0) or on its own, which is treated as /32. The calculator ANDs the address with the mask to find the network address, sets all host bits to find the broadcast address, and reports the first and last usable hosts, the usable host count, the total address count, the class and whether the range is private (RFC 1918), carrier-grade NAT, loopback, link-local, documentation or public. If you enter a host address such as 172.16.5.10/20 it tells you which network that host belongs to, 172.16.0.0/20. The binary view lines up the address, mask and network bit by bit, which is the quickest way to see why a /20 boundary falls where it does.
Two prefixes break the usual "minus two" rule, and the calculator handles both. A /31 has only two addresses, and RFC 3021 allows both to be used as hosts on a point-to-point link, so it shows 2 usable hosts and no broadcast address. A /32 is a single host route, common for loopbacks and firewall rules, with one usable address. Every other prefix reserves the network and broadcast addresses, giving 2^(32 - prefix) - 2 usable hosts.
IP range to CIDR, and calculating CIDR from a subnet mask
Firewalls, cloud security groups and allow-lists usually want CIDR blocks, but vendors often publish ranges as start and end addresses. The IP range to CIDR panel converts any inclusive range into the smallest list of blocks that covers it exactly, with no addresses added or missed. 10.0.0.0 to 10.0.0.255 becomes the single block 10.0.0.0/24, while 10.0.0.0 to 10.0.1.127 needs two blocks, 10.0.0.0/24 and 10.0.1.0/25. The algorithm takes the largest block that starts on an aligned boundary and does not pass the end address, then repeats from the next address.
To calculate CIDR from a subnet mask, type the mask into the mask to prefix box: 255.255.255.192 is /26 because it has 26 one-bits. A mask with gaps, such as 255.0.255.0, is rejected because it cannot be expressed as a prefix. The reverse box turns a prefix into its mask and wildcard, and the cheat sheet lists every prefix from /0 to /32 with its mask, address count and usable hosts.
IPv6 prefixes
Enter an IPv6 address with a prefix, such as 2001:db8:abcd::/48, and the calculator returns the network, the first and last addresses in both compressed (RFC 5952) and fully expanded form, and the address count as a power of two. IPv6 has no broadcast address and subnets are normally /64, so host-count arithmetic matters less than knowing where a prefix starts and ends. All calculations run locally in your browser using JavaScript numbers for IPv4 and BigInt for 128-bit IPv6 addresses.
How to use the CIDR Calculator with IP Range to CIDR and IPv6 tool
- 1
Enter an address and prefix
Type an IPv4 CIDR such as 192.168.1.0/24, an address with a dotted mask, or an IPv6 prefix.
- 2
Read the subnet details
Check the network and broadcast addresses, the usable host range, host count, subnet mask and wildcard mask.
- 3
Convert a range to CIDR
Enter a start and end address to get the minimal list of CIDR blocks covering exactly that range.
- 4
Convert masks and prefixes
Use the mask and prefix boxes or the /0-/32 cheat sheet to translate between 255.255.255.0 and /24 style notation.
Frequently asked questions
How many usable hosts are in a /24, /31 and /32?
A /24 has 256 addresses and 254 usable hosts, because the network and broadcast addresses are reserved. A /31 has 2 usable hosts on a point-to-point link under RFC 3021, and a /32 is a single host.
How do I convert an IP range to CIDR?
Enter the start and end addresses in the IP range to CIDR panel. It returns the smallest set of CIDR blocks that covers exactly that range; for example, 10.0.0.0 to 10.0.0.255 is 10.0.0.0/24.
How do I calculate CIDR from a subnet mask?
Count the one-bits in the mask. 255.255.255.0 has 24, so it is /24; 255.255.255.192 is /26. Type the mask into the mask to prefix box to get it instantly, or append it to an address in the main input.
What is a wildcard mask?
The bitwise inverse of the subnet mask: 255.255.255.0 becomes 0.0.0.255. Cisco access control lists and OSPF network statements use wildcard masks to say which bits may vary.
Does the calculator support IPv6?
Yes, for prefix basics: network address, first and last address and total count, using 128-bit BigInt arithmetic. It does not plan IPv6 subnets for you.
Related Network Tools
cURL to Fetch Converter
Convert cURL commands to JavaScript fetch() calls instantly
cURL to Axios Converter
Convert cURL commands to Axios request code in seconds
Test API Online: REST Client with cURL Export
Send HTTP requests to CORS-enabled APIs from your browser and copy them as cURL
Mock REST API with Fake Users, Posts and Todos
Free fake REST API with users, posts, todos, comments and products for testing
HTTP Headers Viewer
View HTTP response headers for any URL
User-Agent Parser
Parse and decode user-agent strings
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.

