cidr.ivel.net

CIDR calculator for IPv4 and IPv6

Enter an address with a prefix, such as 192.168.1.0/24 or 2001:db8::/48, to get the subnet mask, the network and broadcast address, and the usable address range.

IPv4 also takes a mask: 10.0.0.0/255.0.0.0 or 10.0.0.0 255.0.0.0. IPv6 takes any notation, e.g. ::ffff:192.0.2.1/128.

192.168.10.37 is a host address in 192.168.8.0/22.

Try:
/22
IP192.168.10.37
Mask255.255.252.0
Network192.168.8.0
Broadcast192.168.11.255
22 network bits10 host bits

Result

CIDR notation
192.168.8.0/22
Subnet mask (netmask)
255.255.252.0
Wildcard mask
0.0.3.255
Network address
192.168.8.0
First usable host
192.168.8.1
Last usable host
192.168.11.254
Broadcast address
192.168.11.255
Total addresses
1,024
Usable hosts
1,022
Address range
192.168.8.0 – 192.168.11.255
Address type
Private-use (RFC 1918)
Class (historical)
C
Address in hex
0xC0A80A25
Address as integer
3232238117
PTR record
37.10.168.192.in-addr.arpa

Split a network into subnets

Pick a subnet size to list the subnets it produces. The one that contains your address is highlighted.

Subnets
#SubnetUsable hostsBroadcast

What CIDR is and how it is calculated

CIDR (Classless Inter-Domain Routing) is the address/prefix notation used for IP networks since 1993 and specified today in RFC 4632. It replaced the old class A, B and C networks, which came only in sizes of 16,777,216, 65,536 or 256 addresses. With CIDR a prefix can be any length: /0 to /32 for IPv4 and /0 to /128 for IPv6.

An IPv4 address has 32 bits. The prefix says how many of them, counting from the left, identify the network. The remaining bits identify a host inside that network.

Step by step: 192.168.10.37/22

  1. The mask has 22 one bits followed by zeros: 255.255.252.0.
  2. Network address = IP AND mask. The host bits become 0, so 192.168.10.37 becomes 192.168.8.0.
  3. The wildcard is the inverted mask, 0.0.3.255. Broadcast address = network address OR wildcard: 192.168.11.255.
  4. With 10 host bits the network has 210 = 1,024 addresses. Take away the network and broadcast addresses and 1,022 usable hosts remain.

The first usable host is the network address plus one (192.168.8.1) and the last is the broadcast address minus one (192.168.11.254).

How IPv6 prefixes work

An IPv6 address has 128 bits, written as eight groups of four hex digits. Each hex digit holds 4 bits, so a prefix that is a multiple of 4 ends exactly on a digit. That keeps addresses and reverse DNS zones readable, which is why most IPv6 plans use prefixes like /48, /56 and /64.

Step by step: 2001:db8:abcd:1234::1/56

  1. Expand the address: 2001:0db8:abcd:1234:0000:0000:0000:0001.
  2. A /56 keeps the first 56 bits, which are the first 14 hex digits: 2001:0db8:abcd:12.
  3. Fill the rest with 0 for the first address, 2001:db8:abcd:1200::, and with f for the last, 2001:db8:abcd:12ff:ffff:ffff:ffff:ffff.
  4. There are 8 bits between /56 and the /64 boundary, so this prefix holds 28 = 256 subnets of /64.

IPv6 has no broadcast address, so the last address is an ordinary one. The reverse DNS zone for this /56 is 2.1.d.c.b.a.8.b.d.0.1.0.0.2.ip6.arpa.

IPv4 CIDR chart: subnet masks and host counts

Each bit added to the prefix halves the network. The chart lists the subnet mask, wildcard mask and number of addresses for every prefix from /32 to /0.

IPv4 prefixes from /32 to /0
PrefixSubnet maskWildcardAddressesUsable hosts
/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
/7254.0.0.01.255.255.25533,554,43233,554,430
/6252.0.0.03.255.255.25567,108,86467,108,862
/5248.0.0.07.255.255.255134,217,728134,217,726
/4240.0.0.015.255.255.255268,435,456268,435,454
/3224.0.0.031.255.255.255536,870,912536,870,910
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294

In a /31 both addresses are usable on point-to-point links (RFC 3021). A /32 is a single address.

IPv6 prefix sizes

Common IPv6 prefix lengths, how many addresses and /64 subnets they hold, and where you usually meet them.

IPv6 prefixes from /128 to /0
PrefixAddresses/64 subnetsTypical use
/1281—Single address: loopback, host route
/1272—Point-to-point link between routers (RFC 6164)
/12416—
/120256—
/1164,096—
/11265,536—
/1081,048,576—
/10416,777,216—
/100268,435,456—
/964,294,967,296—Holds an IPv4-sized space, as NAT64 prefixes do (RFC 6052)
/92236—
/88240—
/84244—
/80248—
/76252—
/72256—
/68260—
/642641One LAN or VLAN; needed for SLAAC
/6026816Smaller delegation some ISPs give customers
/56272256Common delegation to a home or small business
/522764,096
/4828065,536Common assignment to a site or organization
/442841,048,576
/4028816,777,216
/36292268,435,456
/322964,294,967,296Common initial allocation to an ISP or LIR
/282100236
/242104240
/202108244
/162112248
/122116252Blocks IANA allocated to the regional registries
/82120256
/42124260
/32125261All global unicast space, 2000::/3
/02128264The whole address space; ::/0 is the default route

Private and special-purpose address blocks

IANA reserves these blocks for specific uses, and most are not routed on the public internet. The calculator labels them automatically.

IPv4

BlockUseDefined in
0.0.0.0/8This networkRFC 791
0.0.0.0/32This host on this networkRFC 1122
10.0.0.0/8Private-useRFC 1918
100.64.0.0/10Shared address space (carrier-grade NAT)RFC 6598
127.0.0.0/8LoopbackRFC 1122
169.254.0.0/16Link-localRFC 3927
172.16.0.0/12Private-useRFC 1918
192.0.0.0/24IETF protocol assignmentsRFC 6890
192.0.0.0/29IPv4 service continuity prefixRFC 7335
192.0.0.8/32IPv4 dummy addressRFC 7600
192.0.0.9/32Port Control Protocol anycastRFC 7723
192.0.0.10/32TURN anycastRFC 8155
192.0.0.170/32NAT64/DNS64 discoveryRFC 8880
192.0.0.171/32NAT64/DNS64 discoveryRFC 8880
192.0.2.0/24Documentation (TEST-NET-1)RFC 5737
192.31.196.0/24AS112-v4RFC 7535
192.52.193.0/24AMTRFC 7450
192.88.99.0/24Deprecated 6to4 relay anycastRFC 7526
192.88.99.2/326a44 relay anycastRFC 6751
192.168.0.0/16Private-useRFC 1918
192.175.48.0/24AS112 direct delegationRFC 7534
198.18.0.0/15BenchmarkingRFC 2544
198.51.100.0/24Documentation (TEST-NET-2)RFC 5737
203.0.113.0/24Documentation (TEST-NET-3)RFC 5737
224.0.0.0/4MulticastRFC 5771
240.0.0.0/4Reserved for future useRFC 1112
255.255.255.255/32Limited broadcastRFC 919

IPv6

BlockUseDefined in
::/128Unspecified addressRFC 4291
::1/128LoopbackRFC 4291
::ffff:0:0/96IPv4-mappedRFC 4291
64:ff9b::/96IPv4/IPv6 translation (NAT64)RFC 6052
64:ff9b:1::/48Local-use IPv4/IPv6 translationRFC 8215
100::/64Discard-onlyRFC 6666
100:0:0:1::/64Dummy IPv6 prefixRFC 9780
2000::/3Global unicastRFC 4291
2001::/23IETF protocol assignmentsRFC 2928
2001::/32TeredoRFC 4380
2001:1::1/128Port Control Protocol anycastRFC 7723
2001:1::2/128TURN anycastRFC 8155
2001:1::3/128DNS-SD Service Registration Protocol anycastRFC 9665
2001:2::/48BenchmarkingRFC 5180
2001:3::/32AMTRFC 7450
2001:4:112::/48AS112-v6RFC 7535
2001:10::/28Deprecated, formerly ORCHIDRFC 4843
2001:20::/28ORCHIDv2RFC 7343
2001:30::/28Drone Remote ID entity tags (DETs)RFC 9374
2001:db8::/32DocumentationRFC 3849
2002::/166to4RFC 3056
2620:4f:8000::/48AS112 direct delegationRFC 7534
3fff::/20DocumentationRFC 9637
5f00::/16Segment Routing (SRv6) SIDsRFC 9602
fc00::/7Unique local (ULA)RFC 4193
fe80::/10Link-localRFC 4291
fec0::/10Site-local, deprecatedRFC 3879
ff00::/8MulticastRFC 4291

Frequently asked questions

What does /24 mean in an IP address?

It means the first 24 bits of the address identify the network. The matching subnet mask is 255.255.255.0, and the network has 256 addresses, 254 of which can be assigned to hosts.

How many hosts fit in a subnet?

For IPv4, 2 to the power of (32 minus the prefix), minus two: the network address and the broadcast address. A /26 has 64 addresses and 62 hosts, and a /30 has 4 addresses and 2 hosts.

What is the difference between a subnet mask and a wildcard mask?

A wildcard mask is the subnet mask inverted: every 1 bit becomes 0 and every 0 bit becomes 1. The mask 255.255.255.0 has the wildcard 0.0.0.255. Wildcard masks are used in Cisco ACLs and OSPF configuration.

Why does a /31 have two usable hosts?

RFC 3021 allows both addresses of a /31 to be used on point-to-point links, where no broadcast address is needed. This saves addresses on links between routers. The IPv6 equivalent is a /127 (RFC 6164).

Which IP addresses are private?

In IPv4: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). The IPv6 counterpart is unique local addresses in fc00::/7; in practice fd00::/8 with a random 40-bit global ID (RFC 4193). None of these are routed on the public internet.

Why is /64 the standard IPv6 subnet size?

IPv6 hosts use the last 64 bits of the address as their interface identifier, and stateless address autoconfiguration (SLAAC) needs a /64 to work. That is why a LAN gets a /64 even though it holds 2⁶⁴ addresses, and why providers delegate larger prefixes such as a /56 or a /48 to customers.

Does IPv6 have a broadcast address?

No. IPv6 replaces broadcast with multicast, such as ff02::1 for all nodes on a link, so the last address of a prefix is an ordinary address. The first one, with an all-zero interface identifier, is the Subnet-Router anycast address (RFC 4291), so it is normally not assigned to a host.

How is an IPv6 address shortened?

RFC 5952 sets the rules: drop leading zeros in each group, replace the longest run of two or more all-zero groups with "::" (once), and write hex digits in lowercase. So 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1. The calculator accepts any valid form and shows both the short and the expanded one.

Can I enter a subnet mask instead of a prefix?

Yes, for IPv4: 192.168.1.0/255.255.255.0 or 192.168.1.0 255.255.255.0. The calculator converts the mask to a prefix and checks that its 1 bits are contiguous. Cisco-style wildcard masks such as 0.0.0.255 work too. IPv6 always uses a prefix length.

Is anything I type sent anywhere?

No. The calculator runs entirely in your browser. After the page loads it makes no network requests and sets no cookies. You can confirm this in the Network tab of your browser's developer tools.