Reading IP addresses in binary, hex and decimal
IP addresses are fundamentally numbers. The dotted-decimal notation (192.168.1.1) is human-friendly, but routers, ACLs, and subnet calculations often require you to think in binary or hexadecimal. Understanding all three representations is essential for subnetting, VLSM design, and troubleshooting network masks and host bits.
Decimal: The standard notation
An IPv4 address is a 32-bit number split into four 8-bit octets, each displayed in decimal. Each octet ranges from 0 to 255 (2^8 - 1). The address 192.168.1.1 is four separate decimal numbers: 192, 168, 1, and 1. This notation is convenient for humans but masks the bit-level operations that subnetting requires.
Binary: Where subnetting happens
Binary is the native language of networking. Each decimal octet converts to 8 bits. To convert a decimal octet to binary, repeatedly divide by 2 and track remainders, or use the positional method: 128, 64, 32, 16, 8, 4, 2, 1.
Decimal 192 to binary: 192 = 128 + 64 = 11000000 Decimal 168 to binary: 168 = 128 + 32 + 8 = 10101000 Full address 192.168.1.1 in binary: 11000000.10101000.00000001.00000001
Binary reveals the true structure of subnets. A /24 mask (255.255.255.0) is 11111111.11111111.11111111.00000000 in binary: the first 24 bits identify the network; the last 8 bits identify hosts. Subnet calculations, VLSM design, and wildcard mask creation all depend on binary thinking.
Hexadecimal: Compact and efficient
Hexadecimal (base 16) compresses binary into a more readable form. Each hex digit represents 4 bits (a nibble), so each octet becomes 2 hex digits. This is common in packet captures, memory dumps, and some routing protocol outputs.
Decimal to hex conversion (per octet): 192 (decimal) = C0 (hex) [12 * 16 + 0] 168 (decimal) = A8 (hex) [10 * 16 + 8] 1 (decimal) = 01 (hex) 1 (decimal) = 01 (hex) 192.168.1.1 in hex: C0A80101
Hex is useful when reading packet captures or protocol analyzers. For example, an Ethernet frame or IPv4 header dump often shows addresses in hex. Knowing the mapping (A=10, B=11, C=12, D=13, E=14, F=15) lets you quickly decode what you see.
Practical conversion workflow
- →Decimal to binary: use the 128-64-32-16-8-4-2-1 positional method per octet
- →Binary to decimal: sum the bit positions where 1 appears
- →Decimal to hex: divide by 16, use remainders; A-F for values 10-15
- →Hex to decimal: multiply each digit by 16^position and sum
- →Binary to hex: group 4 bits per hex digit (left to right)
- →Hex to binary: expand each hex digit to 4 bits
These conversions appear constantly in CCNA and NSE labs: calculating usable host ranges, designing subnets with specific requirements, reading packet traces, and interpreting access control lists. Mastery of all three formats eliminates guesswork and speeds up real-world troubleshooting.