HackMyIP
← back to sheets

What Is a Subnet Mask? (And How to Read One)

~/sheets/what-is-a-subnet-mask.md
1

What a Subnet Mask Actually Does

2

A subnet mask splits an IP address into two parts: the network portion (which network the address belongs to) and the host portion (which specific device on that network). An IPv4 address is 32 bits; the mask marks how many of those leading bits identify the network. The classic home-network mask 255.255.255.0 says "the first 24 bits are the network, the last 8 bits are the host."

3

That same idea is written more compactly as CIDR notation255.255.255.0 is /24. You can experiment with the relationship directly in our CIDR calculator, which expands a prefix into its address range, or work the other direction with the IP Range to CIDR tool.

4

What 255.255.255.0 Means

5

Read the mask as binary: each 255 octet is eight 1 bits (network), and the 0 octet is eight 0 bits (host). So 255.255.255.0 = 24 network bits + 8 host bits = a /24. The 8 host bits give 28 = 256 total addresses in that block, of which 254 are usable for devices (the first is the network address and the last is the broadcast address).

6

How to Calculate a Subnet Mask

7

The math is fixed by the prefix length. Total addresses in a block = 2(32 − prefix). Usable hosts = total − 2 (for the network and broadcast addresses). So a /24 = 256 total / 254 usable, a /25 = 128 / 126, a /26 = 64 / 62, and a /30 = 4 / 2 (the smallest block useful for a point-to-point link). A /31 is a special case (RFC 3021) that allows just 2 addresses with no network or broadcast reserved, used for point-to-point links. Rather than do this by hand, drop a prefix into the CIDR calculator and read the exact range and count.

8

Subnet Mask vs CIDR Notation

9

They describe the same thing in two formats. The dotted-decimal mask (255.255.255.0) is the older notation; CIDR (/24) is the compact modern form that simply counts the network bits. Every standard mask has a CIDR equivalent: 255.255.0.0 = /16, 255.255.255.128 = /25, 255.255.255.252 = /30. Most networking tools and router configs now accept CIDR directly.

10

Where You See Subnet Masks

11

Your device shows its subnet mask alongside its IP in the network settings (run ipconfig on Windows or ip addr on Linux). Home networks almost always use a /24 (255.255.255.0) on a private RFC 1918 range like 192.168.1.0/24. The mask is what lets your device decide whether a destination is local (send it directly) or remote (hand it to the default gateway).

12

Frequently Asked Questions

13

What is a subnet mask used for?

14

A subnet mask is used to split an IP address into a network part and a host part, so a device can tell which addresses are on its own local network and which are remote. Anything local is sent directly, and anything remote is handed to the default gateway. It is essential for routing and for organizing addresses into subnets.

15

How do I calculate a subnet mask?

16

The block size is fixed by the prefix length: total addresses equal 2 to the power of 32 minus the prefix, and usable hosts equal that total minus 2 for the network and broadcast addresses. A /24 gives 256 total and 254 usable, a /26 gives 64 and 62, and a /30 gives 4 and 2. A CIDR calculator does this instantly.

17

What is the subnet mask for a /24 network?

18

The subnet mask for a /24 network is 255.255.255.0. That means the first 24 bits identify the network and the last 8 bits identify the host, giving 256 total addresses with 254 usable for devices. It is the most common mask on home and small office networks.

19

What is the difference between a subnet mask and CIDR notation?

20

They describe the same split in two formats. A subnet mask is the dotted-decimal form like 255.255.255.0, while CIDR notation is the compact form like /24 that simply counts the network bits. Every standard mask has a CIDR equivalent, for example 255.255.0.0 equals /16.

21

What does 255.255.255.0 mean?

22

It means the first three octets, 24 bits, are the network portion and the last octet, 8 bits, is the host portion. That leaves 256 total addresses in the block and 254 usable for devices, since one address is reserved for the network and one for the broadcast. In CIDR it is written as /24.

23
Last updated: April 2026