IP Subnet Calculator, CIDR, Mask, Hosts, IPv4 & IPv6
Calculate network address, broadcast, usable host range and subnet mask from any IPv4 or IPv6 address. The IP Subnet Calculator shows the binary AND that produces it.
All calculation runs in your browser. Nothing you enter is sent to a server.
Results update as you type. Ctrl/Cmd+Enter copies the primary result.
Result
—
Bit view
Show the working
The IP Subnet Calculator takes an IPv4 or IPv6 address with a prefix length and returns the network address, broadcast address, usable host range, subnet mask, wildcard mask and host count. Every result is shown alongside the binary operation that produced it, so the mask can be checked rather than trusted. The calculator also splits a network into smaller subnets and flags addresses that fall inside private or reserved ranges.
All calculation runs in your browser. Nothing you enter is sent to a server.
Calculate an IPv4 subnet from an address and prefix
An IPv4 subnet is defined by two things: a 32-bit address and a prefix length that says how many of those bits identify the network. Enter 202.47.56.51/24 and the calculator reads the first 24 bits as the network and the remaining 8 as the host portion, then derives every other value from that split.
The prefix can be entered three ways, and all three mean the same thing: CIDR notation (/24), a dotted-decimal subnet mask (255.255.255.0), or a required host count that the calculator rounds up to the nearest prefix that fits. Network engineers think in CIDR, older equipment documentation uses dotted decimal, and people planning an address scheme start from host counts.
Read the network, broadcast and host range
Four addresses matter in any IPv4 subnet, and two of them cannot be assigned to a device. The network address is the first address in the range, with every host bit set to zero. The broadcast address is the last, with every host bit set to one. Everything between them is assignable.
For 202.47.56.51/24:
| Field | Value |
|---|---|
| Network address | 202.47.56.0 |
| First usable host | 202.47.56.1 |
| Last usable host | 202.47.56.254 |
| Broadcast address | 202.47.56.255 |
| Subnet mask | 255.255.255.0 |
| Wildcard mask | 0.0.0.255 |
| Total addresses | 256 |
| Usable hosts | 254 |
The wildcard mask is the bitwise inverse of the subnet mask. Cisco access control lists and OSPF configuration take wildcards rather than masks, and inverting one by hand at three in the morning is how outages happen.
Apply the subnet mask with a binary AND
The network address comes from a bitwise AND between the address and the mask. Every bit where the mask is 1 passes through; every bit where the mask is 0 becomes 0. That single operation is the whole of subnetting, and seeing it in binary makes the rest obvious.
IP 11001010 . 00101111 . 00111000 . 00110011 202.47.56.51
Mask 11111111 . 11111111 . 11111111 . 00000000 255.255.255.0
───────────────────────────────────────── bitwise AND
Network 11001010 . 00101111 . 00111000 . 00000000 202.47.56.0
└──────────── network ─────────┘ └─ host ─┘
The broadcast address is the same operation with the host bits set to 1 instead:
Network 11001010 . 00101111 . 00111000 . 00000000 202.47.56.0
Wildcard 00000000 . 00000000 . 00000000 . 11111111 0.0.0.255
───────────────────────────────────────── bitwise OR
Broadcast 11001010 . 00101111 . 00111000 . 11111111 202.47.56.255
The calculator renders this view for every address you enter, with the network and host portions bracketed. The bits are clickable, so toggling one shows immediately what it does to the range.
Subnet 202.47.56.51 with a /24 prefix
A /24 prefix on 202.47.56.51 produces a network of 202.47.56.0 with 254 usable hosts. Here is every step. 1. Convert the prefix to a mask. A /24 means the first 24 bits are network. Twenty-four ones followed by eight zeros is 11111111 11111111 11111111 00000000, which in dotted decimal is 255.255.255.0.
2. AND the address with the mask. 202.47.56.51 AND 255.255.255.0 = 202.47.56.0. The first three octets pass through unchanged because their mask bytes are all ones; the fourth becomes zero because its mask byte is all zeros.
3. Count the addresses. 32 − 24 = 8 host bits, and 2⁸ = 256 total addresses.
4. Subtract the two reserved addresses. 256 − 2 = 254 usable hosts. The network address 202.47.56.0 and the broadcast address 202.47.56.255 cannot be assigned to an interface.
5. Read the usable range. First host is network + 1 = 202.47.56.1. Last host is broadcast − 1 = 202.47.56.254.
Change the prefix to /25 and the same address splits into two networks of 126 usable hosts each: 202.47.56.0/25 covering .1 to .126, and 202.47.56.128/25 covering .129 to .254. Every extra prefix bit halves the host count.
Read the CIDR prefix table
The relationship between prefix length, subnet mask and host count is fixed, and most subnetting work is recognising a handful of common rows on sight. A /24 gives 254 hosts, a /30 gives 2, and a /16 gives 65,534.
| Prefix | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /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 |
The full table from /1 to /32 is available in the calculator. Two patterns are worth memorising: total addresses double with every prefix bit removed, and usable hosts are always total minus two, except at /31 and /32, which work differently.
Understand /31 and /32 prefixes
A /30 is the smallest subnet that follows the usual rules: 4 addresses, 2 usable, one network and one broadcast. Below that, the arithmetic breaks down, and RFC 3021 changed how /31 behaves specifically to stop wasting addresses on point-to-point links.
/31 gives 2 usable addresses, not 0. On a link between two routers there is nothing to broadcast to, the only possible recipient is the device at the other end. RFC 3021 therefore permits a /31 with both addresses assignable and no broadcast address at all. This halves the address consumption of every point-to-point link in a network, which at scale is substantial.
Many subnet calculators, including both of the most widely used ones, still report a /31 as having zero usable hosts. That was correct before 2000 and has been wrong since. Modern routers from every major vendor support /31 on point-to-point interfaces.
/32 is a single host route. One address, no network or broadcast concept. It is used for loopback interfaces, host-specific routing entries, and to advertise a single address into a routing protocol.
Split a network into smaller subnets
Splitting takes one network and divides it into equal blocks at a longer prefix. Enter a starting network and either a target prefix, a number of subnets needed, or a required host count per subnet, and the calculator enumerates the results with their ranges.
Dividing 192.168.10.0/24 into four subnets means moving from /24 to /26, because 2² = 4:
| Subnet | Network | Usable range | Broadcast |
|---|---|---|---|
| 1 | 192.168.10.0/26 | .1 to .62 | 192.168.10.63 |
| 2 | 192.168.10.64/26 | .65 to .126 | 192.168.10.127 |
| 3 | 192.168.10.128/26 | .129 to .190 | 192.168.10.191 |
| 4 | 192.168.10.192/26 | .193 to .254 | 192.168.10.255 |
Real address plans rarely need equal blocks. Variable-length subnet masking assigns each segment only the prefix it needs, a /30 for a router link, a /26 for a small office, a /23 for a large user VLAN, which is why entering a required host count is usually more useful than entering a subnet count. Allocate the largest blocks first, from the start of the range, or the plan will fragment.
Identify private and reserved ranges
Certain address blocks are set aside and never routed on the public internet. The calculator labels any address that falls inside one, with the RFC that defines it, because using a reserved range by accident produces failures that look like anything except an addressing problem.
| Range | Purpose | RFC |
|---|---|---|
| 10.0.0.0/8 | Private network | RFC 1918 |
| 172.16.0.0/12 | Private network | RFC 1918 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local, APIPA | RFC 3927 |
| 100.64.0.0/10 | Carrier-grade NAT | RFC 6598 |
| 192.0.2.0/24 | Documentation | RFC 5737 |
| 224.0.0.0/4 | Multicast | RFC 5771 |
A device showing a 169.254.x.x address has failed to get a DHCP lease and assigned itself a link-local address. That single fact resolves a large share of "no internet" support calls, and the address is the diagnosis.
The 100.64.0.0/10 range catches people out because it looks public. It is reserved for carrier-grade NAT, and seeing it on a WAN interface means the ISP is not providing a public address.
Calculate an IPv6 subnet
IPv6 addresses are 128 bits instead of 32, written as eight groups of four hexadecimal digits. The prefix works the same way, /64 means the first 64 bits identify the network, but three things differ enough to catch out anyone applying IPv4 habits.
There is no broadcast address. IPv6 replaced broadcast with multicast entirely. A calculator that reports an IPv6 broadcast address was written by someone who only knows IPv4, and this calculator omits the field rather than showing it empty.
No addresses are reserved out of a subnet. All 2⁶⁴ addresses in a /64 are usable. There is no "minus two".
/64 is effectively fixed for normal subnets. Stateless address autoconfiguration requires a 64-bit interface identifier, so subnetting below /64 breaks SLAAC. Sites receive a /48 or /56 and divide it into /64s, one per VLAN, with no need to size them against host counts. A /48 provides 65,536 /64 subnets, which is more than any single site will use.
For 2001:db8:85a3::8a2e:370:7334/64 the network is 2001:db8:85a3::/64, containing 18,446,744,073,709,551,616 addresses. The calculator shows that as 2⁶⁴ as well, because the digit string is unreadable and the exponent is the number you actually wanted.
The :: in an address is zero compression, replacing one run of consecutive zero groups. It can appear only once, since two would be ambiguous. The calculator normalises any address to the canonical form defined in RFC 5952 and shows the fully expanded form alongside it.
Understand address classes and why CIDR replaced them
Address classes divided the IPv4 space into fixed blocks: class A with an 8-bit network portion, class B with 16, class C with 24. The first octet determined the class, and the mask followed automatically. That system was replaced by CIDR in 1993 and no modern network is designed around it.
Classful addressing wasted enormous amounts of space. An organisation needing 300 addresses was too large for a class C's 254 and received a class B's 65,534, stranding 65,000 addresses. CIDR removed the fixed boundaries and allowed a prefix of any length, so that organisation now receives a /23 with 510 hosts.
Classes persist in two places. Certification syllabuses still teach them, and some equipment still infers a default mask from the first octet when none is given. The calculator reports the class an address would have fallen into, because people are asked for it, but the prefix is always what determines the actual network.
Frequently asked questions
What is a subnet mask?
A subnet mask is a 32-bit value that marks which bits of an IP address identify the network and which identify the host. Network bits are 1, host bits are 0, and the ones always come first. 255.255.255.0 marks the first 24 bits as network, which is the same thing as a /24 prefix written in CIDR notation.
How many hosts are in a /24?
A /24 contains 256 total addresses and 254 usable hosts. Eight host bits give 2⁸ = 256 addresses, and two are unavailable: the network address at the start of the range and the broadcast address at the end. The usable range for 192.168.1.0/24 is 192.168.1.1 through 192.168.1.254.
What is CIDR notation?
CIDR notation writes an address with a slash and the number of network bits, as in 192.168.1.0/24. It replaced classful addressing in 1993 and allows any prefix length rather than the fixed 8, 16 and 24-bit boundaries the classes imposed. A /24 and a mask of 255.255.255.0 describe exactly the same network.
Why are two addresses in a subnet unusable?
The first address in a subnet has all host bits set to zero and identifies the network itself. The last has all host bits set to one and is the broadcast address for that network. Neither can be assigned to an interface, which is why a /24 with 256 addresses supports 254 hosts. The exception is /31, where RFC 3021 makes both addresses usable.
What is a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask, so 255.255.255.0 becomes 0.0.0.255. Cisco access control lists and OSPF network statements take wildcard masks rather than subnet masks. The calculator returns both, since inverting one by hand is easy to get wrong under pressure.
How do I split a /24 into four subnets?
Move the prefix from /24 to /26, because 2² = 4 subnets. Each /26 has 64 total addresses and 62 usable hosts. For 192.168.10.0/24 the four subnets start at .0, .64, .128 and .192. Enter the network and choose four subnets in the calculator to see the full ranges.
Does IPv6 have broadcast addresses?
No. IPv6 removed broadcast entirely and uses multicast instead, so there is no broadcast address in an IPv6 subnet and no addresses are reserved out of the usable count. All 2⁶⁴ addresses in a /64 are assignable. Any calculator reporting an IPv6 broadcast address is applying IPv4 rules incorrectly.
Why is /64 the standard IPv6 subnet size?
Stateless address autoconfiguration requires the last 64 bits to be available as an interface identifier, so a subnet longer than /64 breaks SLAAC. Sites receive a /48 or /56 from their provider and divide it into /64s, one per network segment. Host counts never constrain the design, because every /64 holds more addresses than the entire IPv4 space.
Is 192.168.1.0/24 a private range?
Yes. 192.168.0.0/16 is reserved for private use by RFC 1918, along with 10.0.0.0/8 and 172.16.0.0/12. Addresses in these ranges are not routed on the public internet and require network address translation to reach it. The calculator labels any address falling inside a private or reserved block.
What does an address starting 169.254 mean?
An address in 169.254.0.0/16 is link-local, assigned by the device itself after a DHCP request failed. Windows calls this APIPA. The device can reach others on the same physical segment but has no gateway and no internet access. Seeing one usually means the DHCP server is unreachable rather than that anything is wrong with the device.
Summary
The IP Subnet Calculator derives the network address, broadcast address, usable host range, masks and host count from any IPv4 or IPv6 address and prefix, and shows the binary AND that produces them so the result can be verified rather than trusted.
Usable hosts are total addresses minus two on every IPv4 prefix through /30, with /31 giving two usable addresses under RFC 3021 and /32 describing a single host. IPv6 has no broadcast address, reserves nothing out of a subnet, and uses /64 as the standard segment size because SLAAC depends on it. Private and reserved ranges are labelled with the RFC that defines them, and any network can be split into smaller subnets by host count, subnet count or target prefix.