Skip to content
MewixMewix

RGB to HEX

Enter red, green and blue values in any common format and copy the HEX code.

Updated by the Mewix team

Where RGB values come from

  • Photoshop and GIMP: the colour picker shows R, G and B from 0 to 255. Photoshop also shows the HEX, but other apps don’t.
  • Office apps: Word, PowerPoint and Excel custom colour dialogs use RGB.
  • Code and plugins: some tools give colour channels as decimals between 0 and 1. Multiply each by 255 and round first: 0.25, 0.5, 0.75 becomes 64, 128, 191.

Paste the values in any common shape: rgb(64, 128, 191), 64 128 191 or 64,128,191. Values above 255 are capped at 255.

How the conversion works

Each channel is written as a two-digit base-16 number. Divide by 16: the whole part is the first digit and the remainder the second, with 10 to 15 written as A to F. For 191: 191 ÷ 16 = 11 remainder 15, which is BF. Do the same for 64 (40) and 128 (80), and the colour is #4080BF.

Questions

What if I have an alpha value as well?

The converter ignores a fourth value. Keep opacity separate in CSS, for example rgb(13 148 136 / 0.5), or add it as two more HEX digits yourself.

Where do I find the RGB of a colour in an image?

Upload the image to the colour picker and click the pixel; it shows RGB and HEX together.