Subnet calculator

One box. Type 192.168.1.10/24 — or the address and the mask, or just the address — and the whole subnet comes out, with the binary underneath so you can see where the mask cuts.

This one runs on your own device. It is worked out in your browser, so there is nothing to send and nothing to log. Where a tool on this site does send something out, that page says so and names where it goes.

Either 10.0.0.1/8 or 10.0.0.1 255.0.0.0. Without a prefix it assumes /24, and says so.

More options — the binary, and how to count a /31

Neither is needed for the answers above. They are here because some people do need them.

Why 256 addresses give you 254 hosts

A /24 has 256 addresses in it and you can put 254 machines on it. The first address is the network address — the name of the subnet itself, the one with all the host bits at nought — and the last is the broadcast address, with all the host bits at one, which means “everybody on this subnet”. Neither can be given to a machine.

That is where the minus two comes from, and it is why the usable count is always two less than the total. On a /30 — four addresses — it leaves exactly two, which is why /30 was for years the smallest useful subnet.

Take the rule literally and a /31 has two addresses, both of them spoken for, and no room for a host at all. RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links (December 2000), says that on a link between exactly two routers there is nothing to broadcast to, so both addresses may be used: “only two possible addresses may result”, and both are taken as host addresses.

It halves the address space a large network spends on point-to-point links, from four addresses each to two. The option above switches between that reading and the strict one, because old equipment does not always agree.

The three private ranges

RFC 1918, Address Allocation for Private Internets (February 1996), sets aside three blocks that will never be routed on the public internet: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255 and 192.168.0.0–192.168.255.255.

The middle one catches people out. It is 172.16 to 172.31, not all of 172 and not just 172.16 — a /12, which is sixteen /16 blocks. The reading says which range an address falls in, or that it falls in none of them.

Where this comes from

The arithmetic is arithmetic and comes from nobody. The two dated claims are another matter, and both were read at source rather than from memory — an RFC number and a date are exactly the sort of thing that sounds right and is not.

SourceWhat was taken
RFC 3021 Its title and date, and that a 31-bit prefix leaves the host part one bit, so “only two possible addresses may result” and both are taken as host addresses
RFC 1918 Its title and date, and the three private blocks exactly as it lists them: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255 and 192.168.0.0–192.168.255.255

Where to go next

If you are here, these two are probably nearby:

What this does not do

IPv4 only. IPv6 has no broadcast address, no minus two, and 128 bits rather than 32, so almost none of the arithmetic on this page carries over — it is a different page rather than an extra option.

It describes one subnet rather than planning a network. Splitting a block into subnets of different sizes, working out which route wins, or checking whether two subnets overlap are all questions about several subnets at once, and this takes one.