Binary, Hex, and Decimal: A Practical Guide for IT Pros

When you're looking at a subnet mask in binary to understand why a /26 gives 62 hosts, reading a memory address from a crash dump, interpreting file permission bits, or working out what an HTTP status code's hex value means — knowing how to move between number bases stops being abstract and becomes a practical skill.

Why binary is the foundation

Digital computers store and process information as sequences of bits — binary digits, each of which can be 0 or 1. This isn't a design choice so much as a physical reality: transistors have two stable states (on and off), which map directly to 1 and 0.

Binary is base 2. Just as decimal (base 10) has place values of 1, 10, 100, 1000 — each a power of 10 — binary has place values of 1, 2, 4, 8, 16, 32, 64, 128 — each a power of 2.

To read a binary number, add the place values of all the positions that are 1:

10110101
= 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1
= 181

Why hex fills the gap

Binary is precise but verbose. The number 255 in binary is 11111111 — eight characters. That's manageable, but a 32-bit integer becomes a 32-character string of 0s and 1s. Debugging memory addresses in binary would be unusable.

Hexadecimal (base 16) solves this. It uses digits 0–9 and letters A–F, where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit represents exactly four bits (a nibble), so every byte (8 bits) can be written as exactly two hex digits.

The number 255 in hex is FF. A 32-bit integer becomes 8 hex digits. Much more manageable.

Binary:  1111 1111
Hex:     F    F
Decimal: 255

Where you see each in real IT work

Binary in networking — Subnet masks are where binary knowledge earns its keep. When you calculate that /26 means 62 usable hosts, you're relying on the fact that a /26 leaves 6 host bits: 2^6 = 64 addresses, minus the network and broadcast = 62 usable. Understanding subnet masks in binary removes the need to memorize a table. If you want to go deeper on CIDR and VLSM, read Subnetting Without the Headaches.

Subnet mask for /26:
Binary:  11111111.11111111.11111111.11000000
Decimal: 255.255.255.192

Hex in memory and debugging — Memory addresses, crash dump analysis, and low-level debugging all use hexadecimal. A segfault at 0x00000000 is a null pointer dereference; you'll recognize that immediately in hex. In binary it would be 32 zeros.

Hex in color codes — CSS colors are specified as three hex pairs representing red, green, and blue intensity (0–255 each): #1a2b3c = red 26, green 43, blue 60. Graphic and web work requires hex literacy.

Octal in Unix permissions — The classic Unix permission system (the one behind chmod) uses octal. Each permission triple (read, write, execute) maps to 3 bits, and 3 bits = one octal digit (0–7).

Permission bits: rwx r-- r--
Binary:          111 100 100
Octal:             7   4   4
chmod 744

This is why chmod 755 gives the owner all permissions and everyone else read+execute, and chmod 644 gives owner read+write and everyone else read-only. Each digit is a three-bit field.

Hex in hashing and cryptography — Hash values, TLS certificate fingerprints, and encryption keys are all displayed as hexadecimal strings. A SHA-256 hash is 32 bytes = 64 hex characters.

Converting between bases

Decimal to binary: Repeatedly divide by 2 and record the remainders (read remainders from bottom to top).

181 ÷ 2 = 90  r1
 90 ÷ 2 = 45  r0
 45 ÷ 2 = 22  r1
 22 ÷ 2 = 11  r0
 11 ÷ 2 =  5  r1
  5 ÷ 2 =  2  r1
  2 ÷ 2 =  1  r0
  1 ÷ 2 =  0  r1
Read up: 10110101 = 181

Binary to hex: Group binary digits into sets of four from the right, convert each group to its hex digit.

10110101 → 1011 0101 → B5

Hex to decimal: Multiply each digit by 16^position and sum. Or just use the converter.

Mental shortcuts worth knowing

  • 0xFF = 255 (all 8 bits set)
  • 0x80 = 128 (top bit set)
  • 0x0F = 15 (low nibble all set)
  • 0xF0 = 240 (high nibble all set)
  • A power of 2 in hex: 0x100 = 256, 0x200 = 512, 0x400 = 1024, 0x10000 = 65536

Binary Converter — Convert numbers between binary, decimal, hexadecimal, and octal instantly.

Open Tool