
Hexadecimal is base-16: instead of the ten digits 0–9 we use in everyday counting, hex adds six more — A, B, C, D, E, F — to represent the values ten through fifteen. It shows up constantly in tech (think #FF5733 colors), and the reason is elegant once you see it.
Why 16, of all numbers?
Computers think in binary — ones and zeros — but long strings of bits are miserable for humans to read. Here is the trick: exactly four binary digits (a “nibble”) map to exactly one hex digit. So the byte 1111 0101 becomes the tidy F5. Hex is not more “computery” than decimal; it is simply the most compact human-readable shorthand for binary, which is why it is everywhere in low-level tech.
Reading a hex number
Each position is a power of 16. Take 2F: the 2 is in the 16s place and F (which is 15) is in the 1s place, so 2F = 2×16 + 15 = 47 in decimal. Going the other way, 255 in decimal is FF in hex — the largest value a single byte can hold, which is exactly why color channels run 00–FF.
Where you actually meet hex
Colors: a CSS color like #FF5733 is three bytes — red FF (255), green 57 (87), blue 33 (51). Character codes: Unicode code points are written as U+1F600 (that is an emoji). Hashes and IDs: MD5, SHA and Git commit hashes are printed in hex because it is compact. Memory addresses and debugging: a crash log full of 0x7ffee3b0 values is just hex pointers.
Converting without a calculator app
For quick conversions, every operating system calculator has a “programmer” mode that toggles between decimal, hex and binary instantly. In a browser console, (255).toString(16) gives "ff" and parseInt("ff", 16) gives 255. Learning to eyeball the common ones — 0x10 = 16, 0xFF = 255, 0x100 = 256 — is enough for most day-to-day reading.
Frequently asked questions
Why do programmers use hexadecimal instead of decimal?
Because four binary digits map cleanly to one hex digit, hex is the shortest human-readable way to represent binary data like bytes, colors, and memory addresses.
What does the 0x prefix mean?
0x signals that the number that follows is written in hexadecimal, so 0x1F is hex, not the decimal number 1.
How many values fit in two hex digits?
Two hex digits (one byte) represent 0 to 255 — which is exactly why RGB color channels run from 00 to FF.
How do I convert hex to decimal quickly?
Use your OS calculator's programmer mode, or in a browser console run parseInt('ff', 16) to get 255.