Subnet Masks Explained: Dotted-Decimal and CIDR Notation
What a subnet mask does and the two ways to write it, dotted-decimal (255.255.255.0) and CIDR slash notation (/24), with a conversion table, worked examples and common mask mistakes.
A subnet mask tells a device which part of an IP address identifies the network and which part identifies the device on that network. It is how a computer decides whether another address is "local" (reach it directly) or "somewhere else" (send it to the router). Every device with an IP address also has a subnet mask. There are two common ways to write the same mask, and they mean exactly the same thing.
The two ways to write a subnet mask
| Notation | Example | Used where |
|---|---|---|
| Dotted-decimal (also "netmask") | 255.255.255.0 |
Windows network settings, DHCP server scopes, and the network screens of most routers, gateways and radio equipment |
| CIDR / prefix length (slash notation) | /24 |
Router configurations, firewall rules, documentation, cloud networking, addresses written as 192.168.1.0/24 |
They are two spellings of one fact: the number after the slash is the count of leading 1 bits in the mask. The mask 255.255.255.0 is 24 ones followed by 8 zeros, so it is /24.
/24 = 11111111.11111111.11111111.00000000 = 255.255.255.0
/26 = 11111111.11111111.11111111.11000000 = 255.255.255.192
CIDR (Classless Inter-Domain Routing, 1993) replaced the old fixed "class A, B, C" network sizes with prefixes of any length (networking-ip-address-classes). A third notation, the wildcard mask used in some router access lists, is simply the mask inverted (0.0.0.255 for a /24); see acl-access-control-list.
How the mask is used
The device combines the address with the mask bit by bit (a logical AND). Wherever the mask has a 1, the address bit belongs to the network; wherever it has a 0, the bit identifies the host.
Example: a PC is 192.168.1.130 with mask 255.255.255.192 (/26).
Address 192.168.1.130 = 11000000.10101000.00000001.10000010
Mask 255.255.255.192= 11111111.11111111.11111111.11000000
Network 192.168.1.128 = 11000000.10101000.00000001.10000000
The network is 192.168.1.128/26. The host part is the remaining 6 bits, which allow 64 addresses in this subnet. Two of them are reserved: the network address (all host bits 0, here .128) and the broadcast address (all host bits 1, here .191). That leaves 62 usable host addresses, .129 to .190. See networking-unicast-broadcast-multicast.
Common masks
| CIDR | Dotted-decimal mask | Total addresses | Usable hosts | Typical use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Very large private network (10.0.0.0) |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large site or campus |
| /24 | 255.255.255.0 | 256 | 254 | The common default for a LAN |
| /25 | 255.255.255.128 | 128 | 126 | Half a /24 |
| /26 | 255.255.255.192 | 64 | 62 | Quarter of a /24 |
| /27 | 255.255.255.224 | 32 | 30 | Small segment |
| /28 | 255.255.255.240 | 16 | 14 | Small equipment group |
| /29 | 255.255.255.248 | 8 | 6 | A few devices |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point link between two routers |
The usable hosts are always the total minus 2. (A /31 with two addresses is allowed on point-to-point links by modern equipment.)
The mask numbers in the last octet of the table (128, 192, 224, 240, 248, 252) are all you need to memorize. The block size of each subnet is 256 minus that number: a mask ending in .192 gives blocks of 64 (.0, .64, .128, .192).
Worked examples
Which subnet is 10.5.20.77/26 in? Block size is 64, so the blocks start at 0, 64, 128 and 192. 77 falls in the 64 block: network 10.5.20.64, broadcast 10.5.20.127, usable .65 to .126.
Why can't these two talk directly? One PC is 192.168.1.10 and another is 192.168.2.10, both with mask 255.255.255.0. The network parts (192.168.1 and 192.168.2) differ, so each sees the other as "somewhere else" and sends the traffic to its default gateway. With no router that connects them, nothing gets through. If both had mask 255.255.0.0 (/16) they would be in the same subnet and talk directly.
How many addresses does a radio site need? Count every device that needs an address (routers, gateways, repeaters, consoles, recorders, printers), add room for growth, and pick the smallest block that fits. A site with 20 devices that may grow to 28 fits a /27 (30 usable); 40 devices needs a /26.
What happens with the wrong mask
- Too long (too small) a mask on one device. For example
/26on a PC that should be/24. The PC treats some devices on its real network as "somewhere else", so it can reach some neighbors but not others. This is the classic "I can ping one device but not another on the same switch" symptom. - Too short (too big) a mask. The device believes distant addresses are local and tries to reach them directly instead of through the router, so they are unreachable.
- Different masks on devices in the same subnet. They disagree about the subnet's boundaries, with confusing and one-directional failures.
- The network or broadcast address given to a device. The first and last address of a subnet (for example
.0and.255in a/24) cannot be used by a host.
When troubleshooting, run ipconfig /all (see dhcp-vs-static-ip-addressing) on both devices, compare the mask, and work out each address's network as above. network-troubleshooting-commands lists the other tools.
Why subnet at all
Dividing a network into smaller subnets keeps broadcast traffic local, makes it practical to separate radio-system infrastructure from general office traffic (ip-networking-in-two-way-radio-systems), and lets routers and firewalls apply different rules to different groups (networking-switches-routers-hubs, networking-vlan). For the addressing scheme itself see networking-ipv4.
This article is part of the CTI Products Knowledge Base. Questions about RadioPro or MCN products? Call +1 (513) 595-5900 or email info@ctiproducts.com.
Informational only. This article is general background and is not engineering, safety, legal or regulatory advice. Verify requirements with the equipment manufacturer and the applicable authority before relying on it. Product names and trademarks belong to their respective owners.