TOOLTIKI Lovable tool, really free
Colour Formats

RGB to hex

#3366cc
Hex
Every format
Contrast
On white 5.37 Passes AA
On black 3.91 Fails AA
Local · hex and RGB are the same numbers
ebf0fac2d1f099b3e67094db4775d12e5cb824478f1933660f1f3d
Advertisement
320 × 100

Shows any colour as hex, RGB, HSL and OKLCH together, so converting is a matter of reading the line you need rather than running a conversion.

How to use the rgb to hex

1 Set your colour, by picker or by typing a hex value.
2 Switch the format if you need RGB, HSL or OKLCH rather than hex.
3 Tap any swatch to copy it, or copy the whole set at once.

Hex and RGB are the same numbers written differently — `#3366cc` is red 51, green 102, blue 204, each pair of hex digits being one channel in base 16. That is why the conversion is exact and lossless in both directions. HSL is a genuine transformation and is where the interesting behaviour lives: it is easy to reason about, and its lightness is not perceptual, so two colours at the same HSL lightness can look very different in weight. OKLCH fixes that, which is why it is worth knowing about even though hex remains the format everything accepts.

Questions

Write each channel in base 16 as two digits. 51 is 33, 102 is 66, 204 is cc — so rgb(51,102,204) is #3366cc.

MDN — CSS color values
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING