CIDR Notation

IP(v4) addresses have 4 sections, separated by periods.

Each section is a byte, 8 bits. You can call it an octet.

192       . 168       . 0         .15
1100 0000 . 1010 1000 . 0000 0000 . 0000 1111

IP addresses have two parts, network and host.

To indicate which part is network and which part is host, netmasks were used.

192.168.0.15
255.255.255.0

As binary, it looks like this.

1100 0000 . 1010 1000 . 0000 0000 . 0000 1111
1111 1111 . 1111 1111 . 1111 1111 . 0000 0000

So 24 1’s in the netmask means the first 24 bits are for the network, the remaining are for the host.

CIDR notation allows you to do this in a shorter way.

192.168.0.15/24

Here are some quick visualizations.

nnn.hhh.hhh.hhh/8
nnn.nnn.hhh.hhh/16
nnn.nnn.nnn.hhh/24

If you split an octet, you have to do a little binary math.