RGB to HEX converter

Write each RGB number as two hex digits and join them: rgb(255, 215, 0) → FF, D7, 00 → #FFD700.

#FFD700
RGBrgb(255, 215, 0)
HSLhsl(51, 100%, 50%)
HSVhsv(51, 100%, 100%)
HWBhwb(51 0% 0%)
CMYKcmyk(0, 16, 100, 0)
OKLCHoklch(0.89 0.18 95)
OKLABoklab(0.887 -0.017 0.181)
LABlab(87.5 2.9 86.6)
LCHlch(87.5 86.6 88)
DECIMAL16766720
≈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

colorRGBHEX
Whitergb(255, 255, 255)#FFFFFF
Blackrgb(0, 0, 0)#000000
Redrgb(255, 0, 0)#FF0000
Limergb(0, 255, 0)#00FF00
Bluergb(0, 0, 255)#0000FF
Yellowrgb(255, 255, 0)#FFFF00
Cyanrgb(0, 255, 255)#00FFFF
Magentargb(255, 0, 255)#FF00FF
Grayrgb(128, 128, 128)#808080
Orangergb(255, 165, 0)#FFA500
Purplergb(128, 0, 128)#800080
Goldrgb(255, 215, 0)#FFD700
HEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Green#008000rgb(0, 128, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Orange#FFA500rgb(255, 165, 0)
Purple#800080rgb(128, 0, 128)
Pink#FFC0CBrgb(255, 192, 203)
Gray#808080rgb(128, 128, 128)
Gold#FFD700rgb(255, 215, 0)
Navy blue#000080rgb(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.