CIDR and subnet calculator: ranges, merging, subtracting

An address with a mask gives the whole subnet: range, mask, wildcard, number of addresses, the next subnet, and a split into smaller ones. The same page turns IP ranges into CIDR, merges lists of networks into the shortest one, and subtracts some networks from others. IPv4 and IPv6, up to 50,000 lines.

Runs in your browser, nothing is sent

Settings

Prefix

ResultPrivate network
Network
192.168.1.0/24
Address
192.168.1.10
Mask
255.255.255.0
Wildcard mask
0.0.0.255
Range
192.168.1.0 – 192.168.1.255
Broadcast
192.168.1.255
For devices
192.168.1.1 – 192.168.1.254
Addresses
256
Addresses for devices
254
Next subnet
192.168.2.0/24
Previous subnet
192.168.0.0/24
Reverse DNS zone
1.168.192.in-addr.arpa

Everything is worked out in your browser: keys and addresses are not sent anywhere.

Veli shows the same from inside: Diagnostics checks your address, DNS, IPv6 and sites through the tunnel and past it. Free, no sign-up.

Download Veli

Reference

IPv4 masks

In /31 both addresses go to devices (RFC 3021), and /32 is one address. The table is worked out by the same code as the calculator.

PrefixMaskWildcard maskAddressesAddresses for devices
/32255.255.255.2550.0.0.011
/31255.255.255.2540.0.0.122
/30255.255.255.2520.0.0.342
/29255.255.255.2480.0.0.786
/28255.255.255.2400.0.0.151614
/27255.255.255.2240.0.0.313230
/26255.255.255.1920.0.0.636462
/25255.255.255.1280.0.0.127128126
/24255.255.255.00.0.0.255256254
/23255.255.254.00.0.1.255512510
/22255.255.252.00.0.3.2551 0241 022
/21255.255.248.00.0.7.2552 0482 046
/20255.255.240.00.0.15.2554 0964 094
/19255.255.224.00.0.31.2558 1928 190
/18255.255.192.00.0.63.25516 38416 382
/17255.255.128.00.0.127.25532 76832 766
/16255.255.0.00.0.255.25565 53665 534
/15255.254.0.00.1.255.255131 072131 070
/14255.252.0.00.3.255.255262 144262 142
/13255.248.0.00.7.255.255524 288524 286
/12255.240.0.00.15.255.2551 048 5761 048 574
/11255.224.0.00.31.255.2552 097 1522 097 150
/10255.192.0.00.63.255.2554 194 3044 194 302
/9255.128.0.00.127.255.2558 388 6088 388 606
/8255.0.0.00.255.255.25516 777 21616 777 214

Special ranges

These addresses aren't handed out on the internet, or they have a meaning of their own.

0.0.0.0/8
“This network” RFC 791
10.0.0.0/8
Private network RFC 1918
100.64.0.0/10
Provider NAT (CGNAT) RFC 6598
127.0.0.0/8
This device (loopback) RFC 1122
169.254.0.0/16
Link-local RFC 3927
172.16.0.0/12
Private network RFC 1918
192.0.0.0/24
Protocol assignments RFC 6890
192.0.2.0/24
For documentation RFC 5737
192.168.0.0/16
Private network RFC 1918
198.18.0.0/15
For network tests RFC 2544
198.51.100.0/24
For documentation RFC 5737
203.0.113.0/24
For documentation RFC 5737
224.0.0.0/4
Multicast RFC 5771
240.0.0.0/4
Reserved RFC 1112
255.255.255.255/32
Broadcast RFC 919
::/128
Unspecified address RFC 4291
::1/128
This device (loopback) RFC 4291
::ffff:0:0/96
IPv4 inside IPv6 RFC 4291
64:ff9b::/96
NAT64 RFC 6052
100::/64
Discard RFC 6666
2001:db8::/32
For documentation RFC 3849
2002::/16
6to4 (outdated) RFC 3056
3fff::/20
For documentation RFC 9637
fc00::/7
Private network (ULA) RFC 4193
fe80::/10
Link-local RFC 4291
ff00::/8
Multicast RFC 4291

IPv6 prefixes

One home network is a /64. How many of them fit into the prefix you were given:

Prefix
Networks /64
/32
4 294 967 296
/40
16 777 216
/44
1 048 576
/48
65 536
/52
4 096
/56
256
/60
16
/64
1

FAQ

What does /24 mean?

The number after the slash is how many leading bits are the network. In 192.168.1.0/24 the first 24 bits are fixed and the last 8 number the devices: 256 addresses, 254 of them for devices, because the first is the network itself and the last is the broadcast. The mask is 255.255.255.0.

How do I turn an IP range into CIDR?

Choose “Range → CIDR” and write 192.168.1.10-192.168.1.99, or 192.168.1.10-99 for the same last octet. A range that isn't a whole subnet becomes several networks: 10.0.0.1-10.0.0.10 is 10.0.0.1/32, 10.0.0.2/31, 10.0.0.4/30, 10.0.0.8/31 and 10.0.0.10/32.

How are networks merged?

Overlapping and adjacent networks become one when they form a whole block: 10.0.0.0/25 and 10.0.0.128/25 make 10.0.0.0/24. 192.168.1.0/24 and 192.168.2.0/24 are neighbours too, but no single prefix covers exactly them, so they stay two; as a range they are one line.

What is a wildcard mask?

The mask the other way round: 0 where the bit must match, 1 where any will do. /24 is 0.0.0.255. Cisco access lists and OSPF are written this way; the calculator also reads such a mask when you paste it.

Where is subtracting needed?

In AllowedIPs for WireGuard, which has no “except”: the whole internet minus the local network and the server's address. For that there is the AllowedIPs calculator on this site; here you can subtract any lists from each other.

How many addresses does an IPv6 /64 have?

2^64, about 18 quintillion: one network of one home. Providers give out /56 or /48, which are 256 or 65,536 such networks. There is no broadcast in IPv6, so every address can go to a device.