Logocolorspicker.net

Convert RGB to HEX online

Type or paste an RGB color, such as 255, 182, 193 or rgb(255 182 193), and the HEX code appears next to it. You can also pick the color by eye.

RGB to HEX formula

  1. Take the red value and divide it by 16. The whole-number result is the first character and the remainder is the second.
  2. Write 10 to 15 as A to F.
  3. Do the same with green and blue, and put # in front of the six characters.
  4. Example: 255 is 15 and 15, or FF. 182 is 11 and 6, or B6. 193 is 12 and 1, or C1. So RGB 255, 182, 193 is #FFB6C1.
const rgbToHex = (r, g, b) =>
  '#' + [r, g, b].map(n => n.toString(16).padStart(2, '0')).join('');

rgbToHex(255, 182, 193); // '#ffb6c1'

RGB to HEX table of common colors

ColorRGBHEX
Black0, 0, 0#000000
White255, 255, 255#FFFFFF
Gray128, 128, 128#808080
Red255, 0, 0#FF0000
Maroon128, 0, 0#800000
Orange255, 165, 0#FFA500
Gold255, 215, 0#FFD700
Yellow255, 255, 0#FFFF00
Green0, 128, 0#008000
Teal0, 128, 128#008080
Cyan0, 255, 255#00FFFF
Blue0, 0, 255#0000FF
Navy Blue0, 0, 128#000080
Purple128, 0, 128#800080
Magenta255, 0, 255#FF00FF
Pink255, 192, 203#FFC0CB

Frequently asked questions

What is the highest RGB value?

255. Each of the three channels goes from 0 to 255, which is 256 values and fits exactly into two HEX characters.

Why does my HEX code start with a zero?

A value under 16 needs a leading zero: 5 becomes 05. Without it, the code would have only five characters and would not work.

Can I convert RGBA to HEX?

Yes, with eight characters. The last two are the opacity times 255: 50% is 128, which is 80 in HEX, so rgba(255, 0, 0, 0.5) is #FF000080. Enter the three color numbers here and add the last two characters yourself.

RGB to HEX Converter: Color Code, Formula & Table