HEX to RGB Converter
Enter a HEX color code such as #6D46D3 or #F60 to get its RGB values, the CSS rgb() string and the working shown step by step.
rgb(109, 70, 211)#6D46D3hsl(256.6, 61.6%, 55.1%)hsv(256.6, 66.8%, 82.7%)oklch(0.519 0.205 290.1)Working
- R: 6D → 6 × 16 + 13 = 109
- G: 46 → 4 × 16 + 6 = 70
- B: D3 → 13 × 16 + 3 = 211
How to use it
- Type or paste a HEX code (with or without #).
- Read the RGB values and the worked formula below the tool.
- Copy the rgb() value.
How to convert HEX to RGB by hand
Split the six digits into three pairs: red, green, blue. Convert each pair from base 16 to base 10: the first digit times 16, plus the second digit (A=10, B=11, C=12, D=13, E=14, F=15).
Example: #6D46D3 → 6D = 6×16 + 13 = 109, 46 = 4×16 + 6 = 70, D3 = 13×16 + 3 = 211 → rgb(109, 70, 211). A 3-digit code repeats each digit first: #F60 → #FF6600 → rgb(255, 102, 0).
Frequently asked questions
How do I convert a 3-digit HEX code?
Double each digit first: #F60 becomes #FF6600, then convert the pairs as usual. The result is rgb(255, 102, 0).
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.