CIDR / subnet calculator
Works out the network address, host range, masks and address count for any IPv4 or IPv6 block, and divides it into equal subnets.
| Network | 192.168.1.0/24 |
|---|---|
| Network address | 192.168.1.0 |
| Broadcast address | 192.168.1.255 |
| Usable range | 192.168.1.1 – 192.168.1.254 |
| Usable addresses | 254 |
| Total addresses | 256 |
| Subnet mask | 255.255.255.0 |
| Wildcard mask | 0.0.0.255 |
What this tool does
A CIDR block such as 192.168.1.0/24 is a compact way of naming a range of addresses. This tool takes one and answers the questions that follow from it: where the range starts and ends, how many addresses it holds, how many of those can be given to a machine, what the subnet mask looks like, whether a particular address falls inside, and what you get if you cut it into smaller pieces.
It handles IPv4 and IPv6, and it accepts a host address as readily as a network address — paste 192.168.1.57/24 straight out of ip addr and it will tell you the block that address lives in. Everything is arithmetic performed in your browser: no lookups, no server, and it works with the network unplugged.
What the slash number means
An IPv4 address is 32 bits. The number after the slash — the prefix length — says how many of those bits identify the network; the rest identify a host within it. A /24 fixes the first 24 bits and leaves 8 free, which is why it holds 2^8 = 256 addresses.
192.168.1.0 # the address 11000000.10101000.00000001.00000000 # its 32 bits 11111111.11111111.11111111.00000000 # the /24 mask: 24 ones, 8 zeros
Where the mask has a one, the bit belongs to the network and is fixed for every address in the block; where it has a zero, the bit is free to vary and identifies a host. Every extra bit of prefix halves the block. That relationship is the whole of subnetting, and it is worth internalising rather than memorising a table:
- /24 — 256 addresses, 254 usable. The classic small network.
- /25 — 128 addresses, 126 usable. Half a /24.
- /26 — 64 addresses, 62 usable.
- /30 — 4 addresses, 2 usable. The traditional point-to-point link.
- /16 — 65 536 addresses. A /24 sixteen times over, twice.
Why two addresses are missing
A /24 holds 256 addresses but only 254 usable ones, because IPv4 spends two of them. The first address in a block is the network address, which names the block itself and is not assigned to any interface. The last is the broadcast address, which reaches every host on the link at once. That is where the familiar 2^n − 2 comes from.
Two prefixes break that formula, and most calculators get at least one of them wrong:
- A /31 has two addresses, and the formula says zero usable. RFC 3021 defines /31 for point-to-point links, where there is no need for a broadcast address and both addresses are assigned — one to each end. The right answer is 2.
- A /32 is a single address, and the formula says −1. A /32 names one host exactly; it is what you write for a single server in a firewall rule or a route.
This tool follows RFC 3021 and reports 2 and 1 for those cases. If another calculator tells you a /31 has no usable addresses, that is the textbook formula applied past the point where it holds.
The subnet mask and the wildcard mask
The subnet mask is the same information as the prefix length, written as a dotted quad: the network bits are ones and the host bits are zeros. /24 is 255.255.255.0. Older configuration formats want the mask, newer ones want the prefix, and they are interchangeable.
The wildcard mask is the subnet mask inverted — 0.0.0.255 for a /24. Cisco access lists and OSPF network statements are written with it, and the inversion catches people out often enough to be worth stating plainly: in a wildcard mask, a zero bit means "must match" and a one bit means "don't care", which is the opposite of a subnet mask.
IPv6 is the same idea with fewer exceptions
IPv6 addresses are 128 bits instead of 32, and the prefix works identically — a /64 fixes the first 64 bits. The arithmetic is the same; what changes is that two IPv4 complications disappear.
- There is no broadcast address. IPv6 replaced broadcast with multicast, so nothing is reserved at the end of a prefix.
- Nothing is reserved at the start either, so every address in the block is assignable and the usable count equals the total. (The all-zeros address in a subnet is the subnet-router anycast address, a routing convention rather than a hole in the range.)
- There is no dotted subnet mask. IPv6 is always written as a prefix length; a 128-bit mask in text would be unreadable and nothing asks for one.
A /64 is the standard size for a single link, because stateless address autoconfiguration expects 64 host bits. A site is typically given a /48 or /56, which is then split into /64s — one per VLAN or segment. That is why this tool will happily divide a /48 into /64s and tell you there are 65 536 of them.
The address counts get large fast, so they are shown both as a power of two and as a full figure: a /32 holds 2^96 addresses, which is 79 228 162 514 264 337 593 543 950 336. The power is what is readable; the digits are what you copy.
Writing IPv6 addresses the canonical way
One IPv6 address can be written many ways, which makes comparing two of them by eye unreliable. RFC 5952 defines a single canonical text form, and that is what this tool outputs:
- Lowercase hexadecimal, and no leading zeros inside a group — 2001:0db8 becomes 2001:db8.
- The longest run of all-zero groups is replaced by ::, and only the longest. On a tie the leftmost run wins.
- A single zero group is never compressed, because :: would save nothing and create a second spelling.
The expanded form is shown alongside it, with every group padded to four digits. That one is not canonical, but it is the form that lines up in a column when you are comparing a list of addresses.
Splitting a block
Cutting one network into several equal ones is the operation people usually come to a subnet calculator to perform. Each extra bit of prefix doubles the number of subnets and halves their size: a /24 becomes two /25s, four /26s, eight /27s, and so on.
192.168.1.0/24 -> /26 192.168.1.0/26 # addresses 0-63 192.168.1.64/26 # addresses 64-127 192.168.1.128/26 # addresses 128-191 192.168.1.192/26 # addresses 192-255
The subnets tile the parent exactly — no gaps and no overlap — which is a property worth checking when you are carving up address space by hand. Note the counts grow quickly: a /8 split into /24s is 65 536 networks, so the list here is capped and the true total reported next to it rather than the answer being quietly truncated.
Ranges that mean something particular
Some blocks are reserved for a specific purpose, and a network that sits inside one is labelled here. The ones that come up most:
- Private (RFC 1918) — 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Routable inside an organisation, never on the public internet.
- Loopback — 127.0.0.0/8 on IPv4 and ::1 on IPv6. Traffic that never leaves the host.
- Link-local — 169.254.0.0/16 and fe80::/10. Self-assigned, valid only on one link. An IPv4 address in this range usually means DHCP failed.
- Carrier-grade NAT — 100.64.0.0/10. Used between a subscriber and an ISP; seeing it on your own network is a sign of an ISP-side NAT.
- Documentation — 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32. Reserved for examples, which is why they appear throughout this page.
- Unique local — fc00::/7. The IPv6 counterpart to RFC 1918 private space.
The label is applied only when the whole block sits inside the special range, not when it merely overlaps one. A 0.0.0.0/0 covers every private range in existence but is not itself private, and saying otherwise would be worse than saying nothing.
How many hosts are in a /24?
A /24 holds 256 addresses and 254 usable ones. The prefix fixes 24 of the 32 bits and leaves 8 free, so the block is 2^8 = 256 addresses, and IPv4 spends the first of them on the network itself and the last on broadcast — the 2^n − 2 the section above explains, where n is the number of host bits. That subtraction holds for every IPv4 prefix down to /30 and for neither of the two below it: a /31 has 2 usable addresses rather than 0 and a /32 has 1 rather than −1, which is what this tool reports.
- The mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Three whole octets are fixed, which is what makes a /24 the one prefix you can read straight off a dotted quad: the last octet is the host and the three in front of it are the network.
- The usable range runs from .1 to .254. The network address is .0 and the broadcast address is .255, and this tool names both rather than leaving a gap at either end of the range.
- A /24 is two /25s, four /26s or eight /27s — each extra bit halves it — and it is itself one of the 256 /24s that fit inside a /16.
- Older documentation calls this a class C network, because the classful scheme CIDR replaced made a class C exactly 24 bits of network. That is why this tool asks for a slash number rather than a letter: a /26 belongs to no class.
The 254 is arithmetic rather than an inventory. On a working network the router or gateway takes one of them, and a DHCP pool is normally configured over part of the range instead of all of it, so the number of machines you can actually plug in is 253 or fewer. Treat the 254 as the ceiling an addressing plan starts from.
How many hosts are in a /16?
A /16 holds 65 536 addresses and 65 534 usable ones. Sixteen bits are fixed and sixteen are free, so 2^16 = 65 536, and the same two addresses come off the ends — the subtraction that holds down to /30 and stops there, for the /31 and /32 reasons above.
- The mask is 255.255.0.0 and the wildcard mask is 0.0.255.255, so the first two octets are the network and the last two identify the host.
- A /16 is 256 /24s. That is the division people actually perform on one, and it is what the split control here does: give it a /16, ask for /24, and it lists them with the total beside the list.
- 192.168.0.0/16 is a /16, and it is the private range a home router hands addresses out of — which is why 192.168.1.0/24 is the block almost everyone has seen. This tool labels anything inside it Private (RFC 1918).
- Older documentation calls a /16 a class B network. A class B was allocated to an organisation whole, and the habit of picturing one as a single network is left over from that.
Nobody puts 65 534 machines on one link. A /16 is an allocation rather than a broadcast domain: every host on a link sees that link’s broadcast and ARP traffic, and at this size it stops being workable long before the range is full. So the useful question about a /16 is not how many hosts it holds but how it is cut — 256 /24s, or 1 024 /26s, or whatever the segments actually need.
How many hosts are in a /8?
A /8 holds 16 777 216 addresses and 16 777 214 usable ones: 24 host bits, so 2^24, less the network and broadcast addresses. It is the largest block anyone writes by hand, and in practice it is nearly always the same one — 10.0.0.0/8, the biggest of the three private ranges.
- The mask is 255.0.0.0 and the wildcard mask is 0.255.255.255. Only the first octet is fixed, which leaves the other three to plan with.
- A /8 is 256 /16s, or 65 536 /24s. That last figure is why the split list on this page is capped and the true total printed beside it rather than the answer being quietly cut short.
- 10.0.0.0/8 is labelled Private (RFC 1918) here, and 127.0.0.0/8 is the loopback range. Both are eight bits wide because the classful scheme made a class A exactly that, and the labels outlived the classes.
- A /8 of public address space is a different thing altogether. There are only 256 of them in the whole of IPv4, and they were handed to organisations and regional registries decades ago.
The 16 777 214 is not a host count in any useful sense — sixteen million addresses on one link is not a network anybody operates. A /8 is an address plan, and what a plan is judged by is how many subnets it yields and what each one costs: every subnet spends its own network and broadcast addresses, so cutting a /8 into /24s gives 65 536 networks and spends 131 072 addresses doing it. That is the price of subnetting, and it is the reason a plan uses the largest subnets each segment can take rather than the smallest that will fit.
How many addresses does an IPv6 /64 hold?
A /64 holds 18 446 744 073 709 551 616 addresses — 2^64, the same arithmetic with 64 free bits instead of 8 — and every one of them is usable. There is no subtraction to make: IPv6 has no broadcast address and reserves nothing at the start of a prefix, so the usable count is the total. It is also why this tool shows an IPv6 block no broadcast address and no dotted mask, rather than showing them as zero.
- The count is printed as a power of two beside the digits. 2^64 is the form you can read; the digits are the form you copy.
- A /64 is the standard size for one link whether that link carries two machines or two thousand. Stateless address autoconfiguration builds the last 64 bits of an address on the host itself, so the prefix is fixed at 64 by the mechanism and not by how many hosts there are.
- A /64 comes out of a larger allocation: a /48 is 65 536 /64s and a /56 is 256 of them, and one of those two is what a site is usually given to divide.
- One interface normally holds more than one address out of its /64 at once: the address autoconfiguration builds from the prefix, and usually a temporary privacy address beside it that is replaced over time. Counting machines by counting addresses goes wrong in that direction too.
Reading that number as capacity is the mistake IPv4 habits invite. A /64 is not sized to be filled, nothing fills it, and no allocation policy expects it to be; it is sized so that a host can generate its own address on the link without asking anybody. The question a /64 answers is how many links a site has, not how many machines.
Frequently asked questions
- How many usable hosts are in a /24?
- 254. The block holds 256 addresses; the first is the network address and the last is the broadcast address, and neither can be assigned to an interface. The same subtraction gives 126 for a /25, 62 for a /26 and 2 for a /30.
- Why does this say a /31 has two usable addresses when other calculators say none?
- Because RFC 3021 defines the /31 for point-to-point links, where a broadcast address serves no purpose and both addresses are assigned — one to each end of the link. Calculators that report zero are applying the 2^n − 2 formula past the range where it holds.
- What is the difference between a subnet mask and a wildcard mask?
- They are inverses of each other. A subnet mask has ones for the network bits (255.255.255.0 for a /24); a wildcard mask has zeros there instead (0.0.0.255). In a wildcard mask a zero means the bit must match and a one means it is ignored, which is the reverse of the intuition a subnet mask builds.
- Can I paste an address that is not the network address?
- Yes, and it is the common case. Give it 192.168.1.57/24 and it will show you that the network is 192.168.1.0/24 and note that the address you typed is a host inside it. That is exactly what you get from ip addr or ipconfig, so no editing is needed first.
- Why does IPv6 not show a broadcast address or a subnet mask?
- Because neither exists. IPv6 dropped broadcast in favour of multicast, so nothing is reserved at the end of a prefix, and it is always written with a prefix length rather than a dotted mask. Every address in an IPv6 block is assignable, which is why its usable count matches its total.
- What size prefix should an IPv6 subnet be?
- A /64, in almost all cases. Stateless address autoconfiguration assumes 64 host bits, so a smaller prefix breaks it on an ordinary link. Sites are usually allocated a /48 or /56 and split it into /64s, one per segment — there are 65 536 of them in a /48, so there is no need to economise.
- Is anything I enter sent to a server?
- No. It is all arithmetic running in your browser — nothing is looked up, uploaded or logged. That is also why it keeps working with no network connection at all.
- What is the subnet mask for a /16?
- 255.255.0.0. The prefix length and the mask are one piece of information written two ways, and the three round prefixes each fix one more whole octet: /8 is 255.0.0.0, /16 is 255.255.0.0 and /24 is 255.255.255.0. A prefix that is not a multiple of eight lands inside an octet instead — a /26 is 255.255.255.192 — which is the case worth letting this tool work out.
- What is a class C network?
- A /24, in the scheme CIDR replaced. Classful addressing fixed the network part at 8, 16 or 24 bits — class A, class B and class C — so a class C held 256 addresses and 254 usable ones, exactly as a /24 does today. RFC 1519 replaced the classes with arbitrary prefix lengths in 1993, which is why this tool asks for a slash number: a /26 or a /19 has no class to name.
- How many /24s are in a /16?
- 256. Each extra bit of prefix doubles the count, so a /16 is 256 /24s and a /8 is 256 /16s or 65 536 /24s. Paste the block in and set Split into to the smaller prefix: it lists the subnets and reports the true total beside the list, which is what matters once the total runs past what any list should print.
- How many addresses are in an IPv6 /64?
- 18 446 744 073 709 551 616, which is 2^64, and all of them are usable. IPv6 has no broadcast address and reserves nothing at the start of a prefix, so nothing is subtracted and the usable count equals the total — the one place an IPv6 answer here is shorter than the IPv4 one rather than longer.
Related tools
- Cron expression explainer
Read a cron expression, and see when it really runs.
- What is my IP
Your public IPv4 and IPv6, and which one your browser used.
- Unix timestamp converter
Convert epoch time to a date, and back.
- Chmod calculator
Turn file permissions between octal, symbolic and checkboxes.