Subnet Calculator
Enter an IPv4 address with a prefix or a mask to get its network and broadcast address, usable host range, wildcard mask and a bit-by-bit breakdown. Then split the network into equal subnets or plan subnets of different sizes with VLSM.
Subnet details
192.168.1.10/24,
192.168.1.10 255.255.255.0 or a bare address, which uses the prefix
below.
- Network address
- Broadcast address
- First usable host
- Last usable host
- Usable hosts
- Total addresses
- Subnet mask
- Wildcard mask
- CIDR notation
- Legacy class
- Address type
- Entered address
- Address as integer
- Address in hex
Binary breakdown
| Value | Network bits | Host bits | Dotted decimal |
|---|
Everything is calculated in your browser — nothing you enter is sent to a server.
Split into equal subnets
Divides the network from the first card into subnets of one size.
| # | Subnet | First host | Last host | Broadcast | Usable hosts |
|---|
VLSM planner
Fits subnets of different sizes into the network from the first card. List the hosts each subnet needs; the order does not matter.
| Name | Hosts needed | Hosts available | Subnet | Mask | Host range | Broadcast |
|---|
Each subnet gets the smallest block with at least the needed usable hosts; the largest is placed first, so the blocks follow each other without gaps.
How to use the subnet calculator
- Type an IPv4 address into the first field. Add a prefix
(
192.168.1.10/24) or a dotted mask (192.168.1.10 255.255.255.0), or enter a bare address and choose the prefix below it. The selector and the mask field stay in sync. - Read the result: network and broadcast address, usable host range, masks, class, address type, and the address as an integer, in hex and in binary.
- To split that network into equal parts, choose a new prefix, a number of subnets, or the hosts needed per subnet. The table shows the first 256 subnets; the CSV buttons export all of them, up to 65,536.
- To plan subnets of different sizes, list the hosts each one needs in the VLSM planner. Names are optional.
- Use the Copy buttons to paste values elsewhere.
How it works
An IPv4 address is a 32-bit number written as four decimal octets. The
prefix length (/24) says how many leading bits identify the
network; the remaining bits number the hosts inside it. A subnet mask
carries the same information in address form: network bits are 1 and host bits are 0, so
/24 is 255.255.255.0. The ones must be contiguous, which is why
a mask such as 255.0.255.0 is rejected.
Two bitwise operations find the edges of a subnet:
network = address AND mask and
broadcast = network OR wildcard, where the wildcard is the inverted mask.
Worked in binary for 10.0.5.130/26 (the bar marks the end of the 26 network
bits):
address 10.0.5.130 00001010.00000000.00000101.10|000010 mask 255.255.255.192 11111111.11111111.11111111.11|000000 AND network 10.0.5.128 00001010.00000000.00000101.10|000000 wildcard 0.0.0.63 00000000.00000000.00000000.00|111111 OR broadcast 10.0.5.191 00001010.00000000.00000101.10|111111
AND keeps the network bits and clears the host bits; OR then sets every host bit to 1.
With h = 32 − prefix host bits, a subnet contains
2h addresses. The one with all host bits 0 is the network
address, and the one with all host bits 1 is the broadcast address that reaches every
device in the subnet. Neither can be assigned to a device, so the number of usable hosts
is 2h − 2; for a /26 that is 64 − 2 = 62.
Equal split. Moving the prefix from p to a longer
q turns q − p host bits into network bits and creates
2q − p subnets of the same size.
VLSM. Variable-length subnet masking gives each group a subnet sized
for it instead of one size for all. The planner sorts the requirements from largest to
smallest and gives each the smallest block whose 2h − 2
covers the hosts needed. Largest first works because every block size is a power of two
and a block must start on a multiple of its own size: after a larger block, the next free
address is already aligned for any smaller one, so the blocks follow each other without
gaps.
All arithmetic is exact unsigned 32-bit integer arithmetic; nothing is rounded.
Examples
Example 1 — a home network. 192.168.1.10/24: network
192.168.1.0, broadcast 192.168.1.255, hosts 192.168.1.1 – 192.168.1.254 (254 usable),
mask 255.255.255.0, wildcard 0.0.0.255. It is a private class C address; as an integer it
is 3232235786, in hex C0A8010A.
Example 2 — a prefix inside an octet. 172.16.45.200/20:
the mask is 255.255.240.0, so only the first four bits of the third octet belong to the
network. 45 is 0010 1101; keeping 0010 gives 32. Network
172.16.32.0, broadcast 172.16.47.255, hosts 172.16.32.1 – 172.16.47.254, 4,094
usable.
Example 3 — equal split. 192.168.1.0/24 split into /26 gives 22 = 4 subnets: 192.168.1.0, .64, .128 and .192, each with 62 usable hosts. Asking for 50 hosts per subnet leads to the same /26, because a /27 holds only 30.
Example 4 — VLSM. In 192.168.1.0/24, groups of 100, 50, 25, 10 and 2 hosts receive 192.168.1.0/25 (126 hosts), 192.168.1.128/26 (62), 192.168.1.192/27 (30), 192.168.1.224/28 (14) and 192.168.1.240/30 (2). The addresses 192.168.1.244 – 192.168.1.255 (12) stay unallocated.
Subnet mask cheat sheet: /8 to /32
Each extra prefix bit halves the subnet.
| Prefix | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /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 |
| /32 | 255.255.255.255 | 1 | 1 |
/31 and /32. The last two rows break the “minus two” rule. A /31 has only two addresses; RFC 3021 allows both to be used as hosts on a point-to-point link, where no broadcast address is needed. A /32 is a single address, used for one host in routing entries and filters. The calculator reports 2 and 1 usable addresses for them.
Wildcard mask. The wildcard mask is the subnet mask with every bit inverted (each octet is 255 minus the mask octet), so /24 gives 0.0.0.255. A 0 bit means “must match” and a 1 bit means “ignore”. Access control lists and some routing configurations expect this form instead of the mask.
Private and special address ranges
RFC 1918 reserves three blocks for private networks: 10.0.0.0/8,
172.16.0.0/12 (172.16.0.0 – 172.31.255.255) and
192.168.0.0/16. They are not routed on the public internet; hosts that use
them reach it through address translation.
The calculator also recognises loopback (127.0.0.0/8), link-local
(169.254.0.0/16, self-assigned when no address server answers), shared
address space for carrier-grade translation (100.64.0.0/10), multicast
(224.0.0.0/4), reserved (240.0.0.0/4), the documentation blocks
192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24,
“this network” (0.0.0.0/8), protocol assignments
(192.0.0.0/24), benchmarking (198.18.0.0/15) and the limited
broadcast address 255.255.255.255. Everything else is labelled public.
The legacy class (A to E) depends only on the first octet: A is 0–127, B 128–191, C 192–223, D 224–239 and E 240–255. Classes were replaced by classless prefixes in 1993 and are shown for reference only.
Frequently asked questions
Why does a /24 have 254 hosts and not 256?
A /24 contains 256 addresses, but the first is the network address and the last is the broadcast address. Subtracting those two leaves 254 for devices.
How do I choose a prefix for a given number of hosts?
Add 2 to the host count, round up to the next power of two and count the host bits. For 50 hosts: 52 rounds up to 64 = 26, so 6 host bits and a prefix of 32 − 6 = /26. The “Hosts per subnet” mode and the VLSM planner do this for you.
Can I use the first and the last subnet of a split?
Yes. Old classful equipment avoided the all-zeros and all-ones subnets, but with classless routing every subnet in the table is usable.
Does the calculator support IPv6?
No. It covers IPv4 only. IPv6 addresses are 128 bits long, are written in hexadecimal and have no broadcast address, so they need a different tool.
Is anything I enter uploaded?
No. All calculations run in your browser. Your inputs are kept only in this browser's local storage; nothing is sent to a server.
Related tools
- Two's Complement Calculator — convert signed integers to and from their binary form.
- Truth Table Generator — build truth tables for logic expressions with AND, OR and NOT.
- JSON Formatter — format and validate JSON data.
- Regex Tester — test regular expressions against sample text.
- Unit Converter — convert length, weight and temperature units.