RGB to HEX converter
Write each RGB number as two hex digits and join them: rgb(255, 215, 0) → FF, D7, 00 → #FFD700.
#FFD700| RGB | rgb(255, 215, 0) | |
|---|---|---|
| HSL | hsl(51, 100%, 50%) | |
| HSV | hsv(51, 100%, 100%) | |
| HWB | hwb(51 0% 0%) | |
| CMYK | cmyk(0, 16, 100, 0) | |
| OKLCH | oklch(0.89 0.18 95) | |
| OKLAB | oklab(0.887 -0.017 0.181) | |
| LAB | lab(87.5 2.9 86.6) | |
| LCH | lch(87.5 86.6 88) | |
| DECIMAL | 16766720 | |
| ≈ | Gold |
Free·No sign-up·Works offline after the first visit
- 1. Take each number from 0 to 255: R = 255, G = 215, B = 0.
- 2. Divide by 16. The whole part is the first hex digit, the remainder the second: 215 ÷ 16 = 13 remainder 7 → D7.
- 3. Hex digits go 0-9, then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. So 255 = FF and 0 = 00.
- 4. Join the three pairs after a hash: #FFD700.
Common colors in RGB and HEX
| color | RGB | HEX |
|---|---|---|
| White | rgb(255, 255, 255) | #FFFFFF |
| Black | rgb(0, 0, 0) | #000000 |
| Red | rgb(255, 0, 0) | #FF0000 |
| Lime | rgb(0, 255, 0) | #00FF00 |
| Blue | rgb(0, 0, 255) | #0000FF |
| Yellow | rgb(255, 255, 0) | #FFFF00 |
| Cyan | rgb(0, 255, 255) | #00FFFF |
| Magenta | rgb(255, 0, 255) | #FF00FF |
| Gray | rgb(128, 128, 128) | #808080 |
| Orange | rgb(255, 165, 0) | #FFA500 |
| Purple | rgb(128, 0, 128) | #800080 |
| Gold | rgb(255, 215, 0) | #FFD700 |
| HEX | RGB | |
|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green | #008000 | rgb(0, 128, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Purple | #800080 | rgb(128, 0, 128) |
| Pink | #FFC0CB | rgb(255, 192, 203) |
| Gray | #808080 | rgb(128, 128, 128) |
| Gold | #FFD700 | rgb(255, 215, 0) |
| Navy blue | #000080 | rgb(0, 0, 128) |
How to convert RGB to HEX by hand
An RGB color has three numbers from 0 to 255, one each for red, green and blue. A HEX code writes the same three numbers in base 16, two digits each. To convert, divide each number by 16: the result is the first digit and the remainder the second, with 10 to 15 written as A to F. For rgb(65, 105, 225): 65 = 4 × 16 + 1 → 41; 105 = 6 × 16 + 9 → 69; 225 = 14 × 16 + 1 → E1. The HEX code is #4169E1, royal blue.
If the color has transparency, as in rgba(255, 215, 0, 0.5), add a fourth pair for the alpha: multiply 0.5 by 255 to get 128, which is 80 in hex, so the 8-digit code is #FFD70080. If you need a 6-digit HEX, leave the alpha out; the color then shows fully opaque. Values from Adobe RGB documents convert the same way, but the colors may look different because Adobe RGB is a wider color space than the sRGB of the web.
Questions and answers
How do I convert RGB to HEX?
Write each of the three numbers as a two-digit hex number and join them: rgb(255, 215, 0) becomes #FFD700.
How do I convert RGBA to a 6-digit HEX?
Drop the alpha and convert the three color numbers. For an 8-digit HEX, add alpha × 255 as a fourth pair: 0.5 → 80.
What is FF in RGB?
FF is 255, the highest value of one channel. #FF0000 is rgb(255, 0, 0), pure red.