Using it
Type an IPv4 address, or several, one per line. Each comes out as four groups of 8 bits, and a /prefix on the end is kept. The working shows how each number splits into place values, and the rows give the same address as one 32-bit number, a decimal integer and hex, with the kind of range it's in.
Swap the boxes to go the other way: four groups of up to 8 bits with dots or spaces between, or 32 bits in a row.
How it works
An IPv4 address is 32 bits. Written the usual way, it's split into four bytes of 8 bits, and each byte is written as a decimal number from 0 to 255. Converting to binary undoes that, one byte at a time.
Each of the 8 bits has a place value: 128, 64, 32, 16, 8, 4, 2 and 1. To convert a number, go along from 128 and take each value that still fits, subtracting it as you go. Every value you take is a 1, every value you skip a 0.
A worked example
Take 192.168.1.10. 192 is 128 + 64, so 11000000. 168 is 128 + 32 + 8, so 10101000. 1 is just the last place: 00000001. 10 is 8 + 2: 00001010.
Put together, 192.168.1.10 is 11000000.10101000.00000001.00001010. Each group keeps its leading zeros, so every group is exactly 8 bits and the whole address is 32.
The octets in subnet masks
| Decimal | Binary | Ones |
|---|---|---|
| 0 | 00000000 | 0 |
| 128 | 10000000 | 1 |
| 192 | 11000000 | 2 |
| 224 | 11100000 | 3 |
| 240 | 11110000 | 4 |
| 248 | 11111000 | 5 |
| 252 | 11111100 | 6 |
| 254 | 11111110 | 7 |
| 255 | 11111111 | 8 |
Why convert to binary
Subnetting happens in binary. A /24 means the first 24 bits name the network, and 255.255.255.0 is that written as a mask: 24 ones, then 8 zeros. The network address is the address ANDed with the mask, bit by bit. The subnet calculator shows that AND for any address and prefix.
Questions
What is 255.255.255.0 in binary?
11111111.11111111.11111111.00000000: 24 ones and 8 zeros, which is why it's the same as /24.
Why does each part have 8 digits?
Each of the four numbers is one byte, 8 bits. Leading zeros keep every byte the same width, so 1 is written 00000001.
Does it convert IPv6?
No, only IPv4. An IPv6 address is 128 bits, already written in hex, where each hex digit is 4 bits.
Sources
Added . What's new






