Galham › RGB → HEX

RGB to HEX Converter

Enter red, green and blue values from 0 to 255, or paste a full rgb(…) value, and copy the HEX code in one click.

How the conversion works

Convert each channel to a two-digit base-16 number and join them with a # in front. Values under 16 get a leading zero.

rgb(79, 70, 229) → 79 = 4F, 70 = 46, 229 = E5 → #4F46E5

Common questions

How do I convert RGB to HEX?

Convert each of the three numbers to two hexadecimal digits and put them together in order: red, green, blue. For example, rgb(255, 165, 0) becomes #FFA500.

Why is the RGB range 0–255?

Each channel is stored in 8 bits, and 8 bits can hold 256 values (0–255). Three channels give 256 × 256 × 256 = 16,777,216 possible colours.

Keep going with this colour

More Galham tools