How HEX becomes RGB
A HEX code is three pairs of characters: red, green and blue. Each pair is a number from 0 to 255 written in base 16, where the digits run 0–9 then A–F (A = 10, F = 15). To convert a pair by hand, multiply the first character by 16 and add the second.
| #2563EB | Pair | Sum | Value |
|---|---|---|---|
| Red | 25 | 2 × 16 + 5 | 37 |
| Green | 63 | 6 × 16 + 3 | 99 |
| Blue | EB | 14 × 16 + 11 | 235 |
So #2563EB is rgb(37, 99, 235). The highest pair tells you the dominant channel: here blue, at almost full strength.
Three-digit shorthand
CSS allows a 3-digit HEX code when each pair is a repeated character. #F0A means #FF00AA, which is rgb(255, 0, 170). The converter expands it for you.
Questions
Is HEX case-sensitive?
No. #2563eb and #2563EB are the same colour. The converter shows capitals.
My HEX code has 8 digits.
The last two digits are opacity (alpha). Remove them to convert the colour; 80 means about 50 percent and CC about 80 percent.
Can I check if the colour is readable on white?
Use the contrast checker.