Free study tool
IPv4 subnet calculator
Useful for CompTIA Network+ and CompTIA A+ Core 1
Address and prefix
You can paste CIDR notation, like 10.0.12.200/22.
Network 192.168.10.0, 62 usable hosts.
- Network address
- 192.168.10.0/26
- Broadcast address
- 192.168.10.63
- First usable
- 192.168.10.1
- Last usable
- 192.168.10.62
- Usable hosts
- 62
- Total addresses
- 64
- Subnet mask
- 255.255.255.192
- Wildcard mask
- 0.0.0.63
This subnet is private address space, inside 192.168.0.0/16 (RFC 1918).
Worked steps
- 1A /26 mask is 26 ones followed by 6 zeros.Mask11111111.11111111.11111111.11000000255.255.255.192Address11000000.10101000.00001010.00100101192.168.10.37
- 2The last network bit falls in the fourth octet, where the mask is 192. The block size is 256 − 192 = 64.
- 3In that octet, 37 falls in the block starting at 0, the largest multiple of 64 that isn't above it. Later octets become 0, so the network address is 192.168.10.0.
- 4The broadcast address is the block's last address: 0 + 64 − 1 = 63, with later octets set to 255. That gives 192.168.10.63.
- 5Usable hosts run from the address after the network to the one before the broadcast: 192.168.10.1 to 192.168.10.62.
- 66 host bits give 26 = 64 addresses. Leaving out the network and broadcast addresses, 62 are usable.
Sources
- RFC 4632, section 3.1: Basic Concept and Prefix Notation
IETF · Prefix notation gives an address and its number of leading network bits, from /0 to /32; a /32 is a single host route.
- RFC 1122, section 3.2.1.3: Addressing
IETF · A host number of all zeros or all ones is never assigned to a host; all ones in the host part is the directed broadcast.
- RFC 1918, section 3: Private Address Space
IETF · 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are reserved for private networks.
Smallest subnet for a number of hosts
Use a /26, with 62 usable hosts.
- Prefix
- /26
- Subnet mask
- 255.255.255.192
- Usable hosts
- 62
- Spare addresses
- 12
- 1You need 50 host addresses.
- 2Add 2 for the network and broadcast addresses: 52 addresses.
- 3The smallest power of two that holds them is 26 = 64 (25 = 32 is too few), so you need 6 host bits.
- 432 − 6 = 26, so the prefix is /26, mask 255.255.255.192.
- 5That subnet has 62 usable addresses, 12 more than you need.
The block-size method
The working above uses the block-size method, which is quick enough to do on paper during an exam. It needs only the prefix length and one octet of the address.
- Find the octet where the network bits end. For a /26, the first three octets are all network bits and the fourth holds the last two, so the mask there is
192. - The block size is 256 minus that mask octet:
256 − 192 = 64. Subnets start at 0, 64, 128, and 192 in that octet. - The network address is the block start at or below the address's octet. For
.37, that's.0. - The broadcast address is one less than the next block start:
.63. Any octets after the one you worked on become 0 in the network address and 255 in the broadcast address. - Usable hosts sit between the two. With 6 host bits there are 26 = 64 addresses, and 62 are usable once the network and broadcast addresses are left out.
Two prefixes break the pattern. A /31 has no broadcast address, and on a point-to-point link both of its addresses are usable (RFC 3021). A /32 is a single address, a host route.
Common questions
- How many usable hosts are in a /24?
- 254. A /24 has 8 host bits, which is 256 addresses, and the network and broadcast addresses can't be assigned to hosts.
- Why do you subtract 2 from the number of addresses?
- The address with all host bits set to 0 names the network, and the one with all host bits set to 1 is the broadcast address. Neither can be given to a host, except on a /31 point-to-point link or a /32 host route.
- What is a wildcard mask?
- The bitwise inverse of the subnet mask, so 255.255.255.192 becomes 0.0.0.63. Router access lists and some routing protocols use wildcard masks to say which address bits must match.
- What subnet do I need for 50 hosts?
- A /26. You need 52 addresses including the network and broadcast addresses, and the smallest power of two that holds 52 is 64, which leaves 6 host bits and a prefix of 32 − 6 = 26.
More free tools
Subnetting practice
Unlimited subnetting questions. Answer, check, and see the block-size method worked through.Port and protocol reference
The well-known ports for CompTIA A+ and CompTIA Network+, each linked to its IANA registry entry.IPv6 compression and expansion
Shorten or expand any IPv6 address the RFC 5952 way, identify its type, and practice.