EN

RGB to HEX Converter

Enter RGB values such as 109, 70, 211 or rgb(109 70 211) to get the 6-digit HEX code and the working shown step by step.

#6D46D3
#6D46D3
RGBrgb(109, 70, 211)
HSLhsl(256.6, 61.6%, 55.1%)
HSVhsv(256.6, 66.8%, 82.7%)
OKLCHoklch(0.519 0.205 290.1)

Working

  1. R: 109 = 6 × 16 + 13 → 6D
  2. G: 70 = 4 × 16 + 6 → 46
  3. B: 211 = 13 × 16 + 3 → D3
  4. HEX = #6D46D3

How to use it

  1. Type the three RGB numbers (0-255), with or without rgb().
  2. Read the HEX code and the worked formula.
  3. Copy the HEX code.

How to convert RGB to HEX by hand

Divide each channel by 16. The whole-number result is the first HEX digit and the remainder is the second (10-15 are written A-F). Join the three pairs after a #.

Example: rgb(109, 70, 211) → 109 = 6×16 + 13 → 6D; 70 = 4×16 + 6 → 46; 211 = 13×16 + 3 → D3 → #6D46D3.

Frequently asked questions

What if an RGB value has decimals?

HEX can only store whole numbers 0-255 per channel, so round the value first. This converter asks for whole numbers to avoid silent rounding.

Is HEX the same color as RGB?

Yes. A 6-digit HEX code is the same three RGB numbers written in base 16: two digits each for red, green and blue. Converting between them never changes the color.

Related tools