Hexadecimal ("hex" for short) is a number system with 16 digits: 0–9, then A–F standing in for 10–15. It's widely used in programming because it maps neatly onto binary — one hex digit represents exactly 4 bits — while being much more compact and readable than a long string of 0s and 1s.
| Decimal | Hex |
|---|---|
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
If you've worked with CSS colors, you've used hexadecimal already — a color like #FF8A30 is three hex pairs, one each for red, green, and blue (each pair ranges from 00 to FF, i.e. 0–255).
let decimal = parseInt("FF", 16);
console.log(decimal); // 255
let hex = (255).toString(16);
console.log(hex); // "ff"