Networking and developer tools

Work out where a subnet starts and ends and what its masks and address counts are, or turn a Unix timestamp into a date and back again.

Available tools

CIDR Ranges (IPv4)

Each row shows the CIDR prefix, its subnet mask, and the total number of IP addresses inside that block.

CIDR
Subnet mask
Total IPs
0
0.0.0.0
4,294,967,296
1
128.0.0.0
2,147,483,648
2
192.0.0.0
1,073,741,824
3
224.0.0.0
536,870,912
4
240.0.0.0
268,435,456
5
248.0.0.0
134,217,728
6
252.0.0.0
67,108,864
7
254.0.0.0
33,554,432
8
255.0.0.0
16,777,216
9
255.128.0.0
8,388,608
10
255.192.0.0
4,194,304
11
255.224.0.0
2,097,152
12
255.240.0.0
1,048,576
13
255.248.0.0
524,288
14
255.252.0.0
262,144
15
255.254.0.0
131,072
16
255.255.0.0
65,536
17
255.255.128.0
32,768
18
255.255.192.0
16,384
19
255.255.224.0
8,192
20
255.255.240.0
4,096
21
255.255.248.0
2,048
22
255.255.252.0
1,024
23
255.255.254.0
512
24
255.255.255.0
256
25
255.255.255.128
128
26
255.255.255.192
64
27
255.255.255.224
32
28
255.255.255.240
16
29
255.255.255.248
8
30
255.255.255.252
4
31
255.255.255.254
2
32
255.255.255.255
1

What the table is telling you

Each row pairs a CIDR prefix with two things: the subnet mask that expresses it in dotted-decimal form, and the number of IPv4 addresses the block contains. An IPv4 address is 32 bits, and the prefix is simply how many of those bits, counting from the left, are fixed as the network portion. The mask is the same statement written as an address: /24 means 24 leading one bits, which is 255.255.255.0.

Reading down the table, every extra bit of prefix adds a one to the mask and halves the address count. Reading up, it doubles. Every row here comes from one relationship, total = 2(32 − prefix), and once the doubling is in your head you can reconstruct most of the table on a whiteboard.

What subnet mask is a /24?

255.255.255.0. The conversion runs both ways and needs no table once you see it: count the one bits in the mask and that is the prefix. 255 is eight one bits, so three full octets of 255 is /24. 255.255.254.0 is /23, 255.255.252.0 is /22, and 255.255.255.192 is /26, because 192 is two one bits.

Three prefixes carry most of the weight in practice, because they land exactly on octet boundaries: /8 is 16,777,216 addresses, /16 is 65,536, and /24 is 256. Each step of eight bits is a factor of 256, and the mask gains a full 255.

Below /24, everything happens inside the last octet, and these are the block sizes you end up quoting from memory: /25 is 128, /26 is 64, /27 is 32, /28 is 16, /29 is 8, /30 is 4, /31 is 2 and /32 is a single address. The corresponding final mask octets run 128, 192, 224, 240, 248, 252, 254, 255. Each one is the previous value plus the block size.

One rule travels with the sizes: a block always begins at a multiple of its own size. A /26 can start at .0, .64, .128 or .192 and nowhere else; a /28 starts at a multiple of 16. If a network address in a design document is not a multiple of its block size, the design is wrong, and that check costs about two seconds.

Total addresses is not usable addresses

The counts in this table are the full size of each block. In a conventional subnet, the first address is the network address and the last is the directed broadcast, and neither can be assigned to an interface, so usable hosts is normally two fewer than the total. A /24 gives 254, a /28 gives 14, a /30 gives 2.

Two prefixes break that rule. A /32 is a single address with no broadcast to reserve, and a /31 gives you both of its addresses: RFC 3021 defined it for point-to-point links, where two endpoints need no broadcast address between them. Cloud subnets break it in the other direction. AWS reserves five addresses per subnet, Azure five and Google Cloud four, so a /24 VPC subnet hands you around 251 addresses, not 254.

Which prefixes you actually meet

  • /8, /12, /16. The private ranges of RFC 1918, and the shape of most corporate address plans.
  • /24. The default size of an office VLAN or a lab segment. Big enough for a few hundred devices, small enough that the broadcast domain stays sane.
  • /26 to /28. Cloud subnets, DMZs, management networks and anywhere you are carving a /24 into pieces.
  • /30 and /31. Links between two routers. /30 is the traditional choice and wastes half its addresses; /31 is the modern one and wastes none.
  • /32. Loopback interfaces, host routes, single-address firewall rules.
  • /0. The whole address space, which is how the default route 0.0.0.0/0 is written.

Which IPv4 ranges are private?

Three blocks, set aside by RFC 1918 and never routed on the public internet, which is what makes them safe to reuse inside every organisation independently:

BlockRangeAddresses
10.0.0.0/810.0.0.0 – 10.255.255.25516,777,216
172.16.0.0/12172.16.0.0 – 172.31.255.2551,048,576
192.168.0.0/16192.168.0.0 – 192.168.255.25565,536

The middle one causes the most confusion. 172.16.0.0/12 is not 172.16.0.0/16 and does not run to 172.32; twelve bits of prefix fix the first octet and the top four bits of the second, which covers 172.16 through 172.31 inclusive. The mask, 255.240.0.0, makes that clear.

A few other blocks are worth recognising when they turn up in a capture or a routing table: 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (the address a host gives itself when DHCP fails), 100.64.0.0/10 is carrier-grade NAT space from RFC 6598, and 224.0.0.0/4 is multicast.

Table or calculator?

This table answers questions about size. How many addresses is a /22, what mask goes with a /27, how many /26s fit in a /24. It is the faster tool when you are sketching an address plan and need the arithmetic, not the specifics.

When the question is about one particular block, such as where 10.42.7.113/20 starts and ends, what its broadcast address is, or whether a host sits inside the subnet at all, use the IPv4 CIDR calculator, which works out the network and broadcast addresses, the first and last usable host, and the wildcard mask for any address and prefix you give it.

Helpful Links
Links open in a new tab.