IPv4 subnet calculator (CIDR)
Type an IPv4 address such as 192.168.1.10/24, or enter the address and a prefix length. You get the network, broadcast, masks, host range and the number of usable hosts.
Free · no signup Runs in your browser
How do I work out a subnet?
Write the address in binary, keep the first n bits (the prefix length) and set the rest to zero to get the network address; set the rest to one to get the broadcast address. For 192.168.1.10/24 the mask is 255.255.255.0, the network is 192.168.1.0, the broadcast is 192.168.1.255 and the hosts run from 192.168.1.1 to 192.168.1.254, which is 2^(32 − 24) − 2 = 254 usable hosts. The calculator does this for any address and prefix, and splits the network into smaller subnets.
Why we built this tool
Anyone who has set up a home or office network, a cloud virtual network or a firewall rule has needed a subnet answer: how many addresses are in a /26, what is the broadcast address of 10.4.7.130/27, do these two ranges overlap, how do I carve a /24 into four equal parts? The arithmetic is binary and easy to slip on. This calculator gives the whole picture at once, in decimal and binary, and splits a block into smaller ones, with the special cases (/31 and /32) handled the way the standards describe.
Everything is worked out in your browser. Nothing you enter is sent anywhere.
How it works
An IPv4 address is 32 bits, written as four numbers from 0 to 255. CIDR notation adds a slash and a prefix length, the number of leading bits that identify the network; the remaining bits identify hosts. The prefix length gives a mask with that many leading ones: /24 is 255.255.255.0 and /26 is 255.255.255.192. ANDing the address with the mask gives the network address, and setting all the host bits to one gives the broadcast address, which is the same as ORing the network with the wildcard mask (the mask inverted). A block with prefix p holds 2^(32 − p) addresses. In an ordinary subnet, up to /30, the first (network) and last (broadcast) addresses are not assigned to hosts, so there are two fewer usable hosts. A /31 has just two addresses and, under RFC 3021, both are used as hosts on a point-to-point link; a /32 is a single address. To split, the calculator divides the block into 2^(q − p) equal pieces of prefix q.
How to use it
- Type the address, with or without /prefix (192.168.1.10/24 or 192.168.1.10 with 24 in the prefix box).
- Read the network, broadcast, masks, usable range and number of hosts.
- To plan subnets, enter a longer prefix in 'Split into' (for example /26 for a /24) and read the list.
- Check the Type line to see whether the address is in a private (RFC 1918) range.
- Compare the binary rows when you need to see which bits are network and which are host.
Common prefix lengths
A quick reference.
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point) |
| /32 | 255.255.255.255 | 1 | 1 (single host) |
Use cases
- Planning a home, office or lab network
- Setting up cloud networks (a VPC or virtual network) and subnets
- Writing firewall, router and access-list rules
- Checking whether two ranges overlap
- Studying for a networking exam
- Working out how many devices a block can hold
Problems you may run into
Most trouble is about the host bits.
| What you see | Likely cause | What to do |
|---|---|---|
| The address I entered is not the network address | It is a host address inside the subnet | That is fine; the calculator shows the network it belongs to |
| My cloud provider shows fewer usable addresses | Cloud networks reserve extra addresses in every subnet | Check your provider's documentation; the figures here are the standard ones |
| The mask I have is not contiguous | A mask must be ones followed by zeros | Use a prefix length; masks like 255.0.255.0 are not valid CIDR |
| 'Enter an IPv4 address' | A number above 255, a missing part or letters | Use four numbers from 0 to 255 separated by dots |
| Two subnets overlap | One range falls inside the other | Compare the network and broadcast of each; they must not cross |
| IPv6 | This tool is for IPv4 only | IPv6 uses 128-bit addresses and a different convention |
Private addresses
RFC 1918 sets aside three IPv4 blocks for private networks, which are not routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Home routers usually hand out addresses from 192.168.0.0/16 or 10.0.0.0/8. The tool tells you when the address you enter is in one of these ranges. Public addresses are allocated by registries, and for Canada by ARIN; this tool does not look up who owns an address.
The formula
How the answer is worked out.
mask = the first p bits as ones, the rest as zeros; wildcard = mask invertednetwork = address AND mask; broadcast = network OR wildcardaddresses in the block = 2^(32 − p); usable hosts = 2^(32 − p) − 2 (p up to 30)/31: two hosts (RFC 3021); /32: one host; split into /q: 2^(q − p) subnets
All arithmetic uses unsigned 32-bit numbers. The Type line only recognises the RFC 1918 private blocks and the loopback range. Networks that reserve extra addresses (some cloud providers) will show fewer usable hosts than this tool does.
Example: 192.168.1.130/26
Which subnet is this address in?
- Mask/26 = 255.255.255.192; blocks of 64 addresses
- Network130 falls in the block starting at 128: 192.168.1.128
- Broadcast128 + 63 = 192.168.1.191
- Hosts192.168.1.129 to 192.168.1.190: 62
192.168.1.128/26 with 62 usable hosts
Split a /24 into /26 and you get four of these.
Terms on this page
- CIDR
- Classless inter-domain routing: an address with a /prefix length.
- Subnet mask
- A 32-bit pattern of ones then zeros that marks the network part of an address.
- Broadcast address
- The last address in a subnet, used to reach every host on it.
Common questions
How many hosts are in a /24?
256 addresses, 254 usable.
What is a /27?
A block of 32 addresses with 30 usable hosts and mask 255.255.255.224.
What is a wildcard mask?
The subnet mask inverted. It is used in some router access lists.
Why are there two fewer usable addresses?
The first is the network address and the last is the broadcast address.
What about /31 and /32?
A /31 has two usable addresses on a point-to-point link (RFC 3021), and a /32 is a single host.
Does it work for IPv6?
No, only IPv4.
Is anything I enter sent to a server?
No. The calculation happens in your browser and nothing you type leaves your device.
Where these numbers come from
- RFC 4632 — Classless Inter-domain Routing (CIDR) Prefix notation, netmasks and block sizes (a /21 holds 2,048 addresses).
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links A /31 has two addresses, both usable as hosts.
- RFC 1918 — Address Allocation for Private Internets The three private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
Last verified 2026-10-25 The method on this page is checked against the sources above at least once a year. Spotted something out of date? Tell us and we will fix it.
Related tools
chmod calculator
Tick read, write and execute for owner, group and others to get the octal chmod number, the symbolic form and the exact command, or type an octal mode to see what it allows.
Open toolBase converter
Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, exactly, at any size.
Open toolDownload time calculator
Find how long a file takes to download or upload from its size and your connection speed, in Mbps or MB/s, with an allowance for overhead and a table of common speeds.
Open toolHash generator
Get the SHA-256, SHA-512, SHA-384 and SHA-1 hash of text or of a file, and check a download against a hash you were given.
Open toolContrast checker
Check the contrast ratio between text and background colours and see whether it passes WCAG AA and AAA.
Open toolPassword generator
Create strong random passwords of any length with your choice of characters. Made in your browser; nothing is sent or saved.
Open tool🧰 Developer and web tools
Small developer and web jobs done in your browser. What you paste or choose is never sent anywhere.
See all 24 tools in this section