Planning a LAN, writing a firewall rule or studying for a networking exam all come down to the same question: which addresses belong to this subnet? Enter an IPv4 address with a prefix length (/24) or a subnet mask (255.255.255.0) and this calculator returns the network address, the broadcast address, the first and last usable host, the number of hosts, the wildcard mask used in router access lists, and a binary view that shows exactly where the network bits end.
It also tells you what kind of address you typed: a private RFC 1918 range, the RFC 6598 shared space used by carrier-grade NAT, loopback, link-local, multicast, documentation or ordinary public space.
Need several smaller networks? Enter how many subnets you want and the calculator borrows the right number of bits and lists each subnet with its host range.
How to use this calculator
- Type the IPv4 address, for example 192.168.1.10. You can paste CIDR notation directly (10.0.0.0/30).
- Give the network size either as a prefix length (/0 to /32) or as a subnet mask. Masks must be contiguous: 255.255.255.0 is valid, 255.0.255.0 is not.
- Optionally enter the number of subnets you want to carve out of this block.
- Read the network in CIDR form, the host range, the broadcast address, the counts and the binary breakdown. Open the steps to see the bitwise AND.
The formula
An IPv4 address is a 32-bit number. A prefix length sets the first bits of the mask to 1:
The block contains addresses. The first (network) and last (broadcast) are reserved, so
Two exceptions: a /31 has two usable addresses on point-to-point links (RFC 3021), and a /32 designates a single host. Splitting into equal subnets adds bits to the prefix.
Worked example
192.168.1.10/24. The mask 255.255.255.0 keeps the first three octets, so the network is 192.168.1.0 and the broadcast 192.168.1.255. Hosts run from 192.168.1.1 to 192.168.1.254: usable addresses. The address sits in 192.168.0.0/16, a private RFC 1918 range.
10.0.0.0/30, the classic router-to-router link: four addresses, 2 usable hosts (10.0.0.1 – 10.0.0.2), broadcast 10.0.0.3.
Splitting 192.168.1.0/24 into 4 subnets borrows 2 bits, giving /26 networks of 62 hosts each: 192.168.1.0, 192.168.1.64, 192.168.1.128 and 192.168.1.192.
Common prefix lengths
| Prefix | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /26 | 255.255.255.192 | 64 | 62 |
| /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 (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 |
Private and special IPv4 ranges
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks; they are never routed on the Internet and reach it through NAT. RFC 6598 sets aside 100.64.0.0/10 for carrier-grade NAT between an operator and its customers. 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (the address a computer gives itself when DHCP fails), 224.0.0.0/4 is multicast and 240.0.0.0/4 is reserved. Three /24 blocks (192.0.2.0, 198.51.100.0 and 203.0.113.0) exist only for documentation and examples. The full list is maintained by IANA under RFC 6890.
Classes, CIDR and IPv6
Before 1993, the first bits of an address fixed its class: A (/8), B (/16) or C (/24). CIDR (RFC 4632) replaced this with prefixes of any length, so the class shown here is informative only. IPv6 works on the same principle with 128-bit addresses; a typical LAN is a /64, which holds addresses, and there is no broadcast address. This calculator covers IPv4 only.
Frequently asked questions
How many hosts are in a /24?
A /24 holds 256 addresses. Removing the network and broadcast addresses leaves 254 usable hosts, for example 192.168.1.1 to 192.168.1.254.
What is the difference between a subnet mask and a wildcard mask?
The wildcard is the bitwise inverse of the mask: 255.255.255.0 becomes 0.0.0.255. Router access lists and OSPF configurations use wildcards to say which bits may vary.
Can I use a /31 network?
Yes, on point-to-point links. RFC 3021 lets both addresses of a /31 be used as host addresses, saving two addresses per link compared with a /30. There is no broadcast address in a /31.
How do I split a network into subnets?
Borrow host bits: each extra bit doubles the number of subnets and halves their size. For 4 subnets, add 2 bits; for 6, add 3 bits (8 subnets), since the count must be a power of 2. Enter the number in the split field to get the list.
Is my address private or public?
If it falls in 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16 it is private (RFC 1918); 100.64.0.0/10 is carrier-grade NAT space. The Address type output tells you which special block, if any, contains it.
Sources
- RFC 4632, Classless Inter-domain Routing (CIDR)
- RFC 1918, Address Allocation for Private Internets
- RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space
- RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 6890, Special-Purpose IP Address Registries
- IANA IPv4 Special-Purpose Address Registry
Last updated: