A color code like #2563eb, a memory address, a MAC address — hexadecimal shows up constantly in places most people never think to question. It's not arbitrary: hex exists as a convenient middle ground between how computers actually store data (binary) and how humans prefer to read numbers.
The actual relationship between the three
Computers store everything in binary — sequences of 0s and 1s. Binary is precise for machines but painfully long and hard for a person to read at a glance. Decimal (base 10) is what humans naturally think in, but it doesn't map cleanly onto binary's structure. Hexadecimal (base 16) sits in between: it maps exactly onto binary — each hex digit represents precisely 4 binary bits — while being far more compact and readable than writing out long strings of 0s and 1s.
Why colors use hex specifically
A color code like #2563eb actually encodes three separate values — red, green, and blue — each represented as a two-digit hex pair (25, 63, eb). Each pair maps to a value from 0–255, and hex's clean relationship to binary makes it a natural, compact way to represent that range without needing three or four decimal digits per channel.
Why memory addresses use hex
Memory addresses are fundamentally binary — a specific location in a computer's memory — but writing them out in raw binary would be impractically long. Hex compresses that same binary value into a much shorter, more manageable string while still mapping cleanly back to the underlying binary representation, which is exactly why developers debugging low-level code see addresses written in hex rather than decimal or raw binary.
Converting between the three (plus octal)
- Enter a value in any one base — decimal, binary, hex, or octal.
- The other three update automatically.
- For bitwise operations (AND, OR, XOR, NOT, and bit shifts), enter two decimal values and see the result.
Octal (base 8) shows up less often today but still appears in some legacy contexts, like older Unix file permission systems.
Need to convert between number bases? Try the Binary/Hex Calculator — all calculations happen instantly in your browser.