Why look at an IP in binary
Subnetting is binary arithmetic. A netmask like 255.255.255.192 is 26 ones followed by 6 zeros, and an address belongs to a subnet when its first 26 bits match the network's. Writing addresses in binary makes that visible, which is why networking courses and certification exams (CCNA, CompTIA Network+) drill this conversion.
Each octet is an 8-bit number: 192 = 128 + 64 = 11000000, 168 = 128 + 32 + 8 = 10101000.
Worked example
192.168.1.1 → 11000000.10101000.00000001.00000001. As one 32-bit number it is 3,232,235,777, or 0xC0A80101 in hex, the form some databases and logs use to store addresses compactly. Paste binary to go back.
How this works
The page splits each address into four octets, checks that each is between 0 and 255 without leading zeros, and writes each in base 2 padded to eight digits. It also combines the octets into a single 32-bit integer (first octet × 16,777,216 + second × 65,536 + third × 256 + fourth) and shows it in decimal and hexadecimal. If you paste 32 bits, it converts them back to dotted decimal. Each line is converted separately.
Frequently asked
How do I convert an IP octet to binary?
Subtract powers of two from 128 down to 1: 168 = 128 + 32 + 8 → 10101000.
What is 255.255.255.0 in binary?
24 ones and 8 zeros: 11111111.11111111.11111111.00000000, a /24.
Why store an IP as one number?
A 32-bit integer is compact and easy to compare in range queries.
Does it handle IPv6?
No, IPv4 only.
Sources
- RFC 4632 — Classless Inter-domain Routing (CIDR)
- RFC 1918 — Address Allocation for Private Internets
- Wikipedia — IPv4
Reviewed Oct 17, 2026 · test vectors fixtures/dev/ip-to-binary/