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
#6D46D3RGB
rgb(109, 70, 211)HSL
hsl(256.6, 61.6%, 55.1%)HSV
hsv(256.6, 66.8%, 82.7%)OKLCH
oklch(0.519 0.205 290.1)Working
- R: 109 = 6 × 16 + 13 → 6D
- G: 70 = 4 × 16 + 6 → 46
- B: 211 = 13 × 16 + 3 → D3
- HEX = #6D46D3
How to use it
- Type the three RGB numbers (0-255), with or without rgb().
- Read the HEX code and the worked formula.
- 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.