HEX to RGB Converter
To convert HEX to RGB, split the code into three pairs and turn each pair into a number from 0 to 255: first digit times 16 plus the second digit. #1E90FF becomes rgb(30, 144, 255). Paste a hex code below to get RGB, HSL and CMYK with a live color preview.
HEX to RGB converter
The live converter needs JavaScript. Example: #FF6347 = rgb(255, 99, 71) = hsl(9, 100%, 64%) = cmyk(0%, 61%, 72%, 0%).
- HEX
– - RGB
– - HSL
– - CMYK
–
CMYK is approximate. For print, use your printer’s color profile.
The formula
| Step | What to do | Example: dodger blue |
|---|---|---|
| 1 | Split the six digits into three pairs. | #1E90FF → 1E, 90, FF |
| 2 | Convert each pair: first digit × 16 + second digit (A=10 … F=15). | 1×16+14 = 30, 9×16+0 = 144, 15×16+15 = 255 |
| 3 | Write as rgb(R, G, B). | rgb(30, 144, 255) |
| Step | What to do | Example: dodger blue |
|---|---|---|
| 1 | Divide R, G, B by 255; find max and min. | max 1.0, min 0.118 |
| 2 | L = (max + min) / 2. | L = 0.559 → 56% |
| 3 | S = (max − min) / (1 − |2L − 1|). | S = 1.0 → 100% |
| 4 | H from which channel is max (60° sectors). | H = 210° |
Three-digit codes are expanded first by doubling each digit: #F80 becomes #FF8800, which is rgb(255, 136, 0). An eight-digit code has a fourth pair for transparency, which this converter leaves out.
Example conversions
| Color | HEX | RGB | HSL |
|---|---|---|---|
| Red | #FF0000 | 255, 0, 0 | 0°, 100%, 50% |
| Lime green | #00FF00 | 0, 255, 0 | 120°, 100%, 50% |
| Blue | #0000FF | 0, 0, 255 | 240°, 100%, 50% |
| White | #FFFFFF | 255, 255, 255 | 0°, 0%, 100% |
| Black | #000000 | 0, 0, 0 | 0°, 0%, 0% |
| Mid gray | #808080 | 128, 128, 128 | 0°, 0%, 50% |
| Dodger blue | #1E90FF | 30, 144, 255 | 210°, 100%, 56% |
| Tomato | #FF6347 | 255, 99, 71 | 9°, 100%, 64% |
| Gold | #FFD700 | 255, 215, 0 | 51°, 100%, 50% |
| Rebecca purple | #663399 | 102, 51, 153 | 270°, 50%, 40% |
| Teal | #008080 | 0, 128, 128 | 180°, 100%, 25% |
| Saddle brown | #8B4513 | 139, 69, 19 | 25°, 76%, 31% |
HSL rounded to whole numbers. CMYK from the simple formula below, without a color profile.
Where RGB numbers are needed
- Microsoft Word, Excel and PowerPoint custom colors.
- Many video editors, game engines and 3D programs.
- Programming libraries that take three numbers or values from 0 to 1 (divide by 255).
- CSS also accepts
rgb(30 144 255)with spaces, if you prefer numbers to hex.
Frequently asked questions
How do I convert hex to RGB?
Split the six digits into pairs for red, green and blue. For each pair, multiply the first digit by 16 and add the second, counting A as 10 up to F as 15. #FF6347 gives 255, 99 and 71.
What is #000000 in RGB?
#000000 is rgb(0, 0, 0), which is black: no red, green or blue light. #FFFFFF is rgb(255, 255, 255), white, and #FF0000 is rgb(255, 0, 0), pure red.
Does the converter accept short hex codes?
Yes. Type a three-digit code like #0AF and it is expanded to #00AAFF, which is rgb(0, 170, 255). You can write the code with or without the # and in upper or lower case.
What is HSL and why is it shown?
HSL means hue, saturation and lightness. It describes the same color in a way that is easier to adjust by hand: change only L to get a lighter or darker shade of the same color. CSS understands hsl() directly.
Can I paste rgb() or hsl() text?
Yes. The "Paste any code" field accepts a hex code, text like rgb(30, 144, 255) or hsl(210, 100%, 56%), and fills in all the other formats from it.
Last updated: October 15, 2026