IP to binary: see the 32 bits behind an address
Routers never see "192.168.1.1"; they see 32 bits. Converting IP to binary shows those bits, grouped into four octets of eight, so you can reason about subnet masks, prefixes and address classes the same way network hardware does.
Place values of an octet
Each octet is an 8-bit number with the place values 128, 64, 32, 16, 8, 4, 2 and 1. Subtract the largest value that fits, write a 1, and continue with the remainder:
| Decimal | Sum of place values | Binary |
|---|---|---|
| 192 | 128 + 64 | 11000000 |
| 168 | 128 + 32 + 8 | 10101000 |
| 37 | 32 + 4 + 1 | 00100101 |
| 1 | 1 | 00000001 |
Every octet is padded to eight digits. Without padding, 10.1.1.1 would read as 1010.1.1.1, and the columns would no longer line up against a mask.
192.168.1.1 → 11000000.10101000.00000001.00000001
10.0.0.254 → 00001010.00000000.00000000.11111110
8.8.8.8 → 00001000.00001000.00001000.00001000
Why binary matters for subnetting
A subnet mask is a run of 1s followed by 0s. The network address is the bitwise AND of the address and the mask. Take 192.168.10.37 with the /26 mask 255.255.255.192:
address 11000000.10101000.00001010.00100101
mask 11111111.11111111.11111111.11000000
AND 11000000.10101000.00001010.00000000 = 192.168.10.0
The first 26 bits identify the network; the last six (100101 = 37) identify the host inside it. The CIDR calculator performs this for you and lists the whole range, and the AND calculator lets you try the operation on any two values.
Private address ranges in binary
The three private IPv4 blocks look arbitrary in decimal, but in binary each one is simply a fixed prefix:
10.0.0.0/8 00001010.xxxxxxxx.xxxxxxxx.xxxxxxxx
172.16.0.0/12 10101100.0001xxxx.xxxxxxxx.xxxxxxxx
192.168.0.0/16 11000000.10101000.xxxxxxxx.xxxxxxxx
The middle row explains the odd range from 172.16 to 172.31. Only the first four bits of the second octet are fixed (0001), and the remaining four can be anything, from 00010000 (16) to 00011111 (31). An address such as 172.32.0.1 has 00100000 there, so it falls outside the block and is a public address. Loopback works the same way: every address whose first octet is 01111111 (127) belongs to 127.0.0.0/8.
Leading bits and the old address classes
Before CIDR, the first bits of an address decided its class: 0 meant class A, 10 class B, 110 class C and 1110 class D (multicast). In binary this is obvious at a glance: 192 starts with 110, so 192.168.1.1 was a class C address. Classes no longer control routing, but the terms still appear in documentation.
Validation and privacy
The address must hold four decimal octets from 0 to 255; anything else is marked invalid, with an error that quotes the value. To read binary back into dotted form, use Binary to IP. The conversion runs in your browser, so nothing you type is uploaded.