how to convert hex to rgb color manually hgysxwqXXM0
How to Convert Hex to RGB Color Manually: The Complete Playbook
Whether you are designing a website, editing an image, or working with CSS, knowing how to convert hex to RGB by hand is a practical skill that saves time and deepens your understanding of digital color. This guide walks you through every method—short and long hex notation, three-step and six-step conversion—with worked examples, a quick-reference table, and a ready-to-use checklist.
Key Takeaways
- Hex codes use base-16 (digits 0–9 and letters A–F); RGB values use base-10 (0–255 for each channel).
- Short hex (3-character) format like
#F0Aexpands to#FF00AAbefore conversion. - Each hex pair maps directly to one RGB channel: Red = first two digits, Green = middle two, Blue = last two.
- The conversion formula is simple: multiply the first hex digit by 16, add the second hex digit.
- Memorizing the 16 hexadecimal-to-decimal values eliminates the need for a converter tool.
Understanding Hex and RGB Color Notation
What Is a Hex Color Code?
A hex color code is a six-digit (or three-digit shorthand) hexadecimal number preceded by a hash symbol (#). It represents the red, green, and blue components of a color in base-16 notation:
#RRGGBB— full six-character format#RGB— compact three-character format (each digit is duplicated)
What Is an RGB Color Value?
RGB stands for Red, Green, and Blue. Each channel is expressed as a decimal integer from 0 to 255, giving a total of 16,777,216 possible colors:
- R (Red) — first value (0–255)
- G (Green) — second value (0–255)
- B (Blue) — third value (0–255)
The functional form is written as rgb(R, G, B).
Hex-to-Decimal Reference Table
Before converting, memorize or keep handy this reference that maps every two-digit hex pair to its decimal equivalent:
| Hex | Decimal | Hex | Decimal | Hex | Decimal |
|---|---|---|---|---|---|
| 00 | 0 | 10 | 16 | 20 | 32 |
| 01 | 1 | 11 | 17 | 21 | 33 |
| 05 | 5 | 15 | 21 | 25 | 37 |
| 0A | 10 | 1A | 26 | 2A | 42 |
| 0F | 15 | 1F | 31 | 2F | 47 |
| 10 | 16 | 20 | 32 | 30 | 48 |
| 1F | 31 | 2F | 47 | 3F | 63 |
| 40 | 64 | 50 | 80 | 60 | 96 |
| 7F | 127 | 80 | 128 | 9F | 159 |
| AF | 175 | BF | 191 | CF | 207 |
| DF | 223 | EF | 239 | FF | 255 |
Step-by-Step: Converting 6-Character Hex to RGB
Step 1 — Identify the Three Pairs
Given #RRGGBB, split the code into three two-digit groups:
- Pair 1 (Red): digits 1–2
- Pair 2 (Green): digits 3–4
- Pair 3 (Blue): digits 5–6
Step 2 — Convert Each Pair Using the Formula
For each pair, apply:
Decimal = (First digit × 16) + Second digit
Remember the letter values: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
Step 3 — Write the RGB Result
Combine the three decimal values into the format rgb(R, G, B).
Worked Example: Convert #2F8C1A
- Red pair = 2F: (2 × 16) + 15 = 32 + 15 = 47
- Green pair = 8C: (8 × 16) + 12 = 128 + 12 = 140
- Blue pair = 1A: (1 × 16) + 10 = 16 + 10 = 26
- Result:
rgb(47, 140, 26)
Step-by-Step: Converting 3-Character (Short) Hex to RGB
Step 1 — Expand the Short Code
Duplicate each character to create the full six-digit code:
#RGBbecomes#RRGGBB- Example:
#F0A→#FF00AA
Step 2 — Convert as Usual
Apply the same formula to each expanded pair.
Worked Example: Convert #F0A
- Expanded:
#FF00AA - Red = FF: (15 × 16) + 15 = 240 + 15 = 255
- Green = 00: (0 × 16) + 0 = 0
- Blue = AA: (10 × 16) + 1