Colour Converter
Convert a colour between HEX, RGB and HSL and see it beside its values.
Converted colour
- HEX
- RGB
- HSL
How it works
Enter a colour as HEX, RGB or HSL and the other two are shown, with a preview beside the values. A short HEX value such as #369 is expanded to #336699. HEX is shown in capitals as #RRGGBB. RGB channels are whole numbers from 0 to 255. HSL uses a hue in degrees from 0 to 360, and saturation and lightness as percentages from 0 to 100. A hue of 360 is the same colour as 0.
Nothing is clamped or wrapped. A value outside its range, or a HEX value with the wrong number of digits, is reported as an error. HEX with a transparency part is not supported. HSL is shown to one decimal place, so converting a shown HSL value back can be out by 1 in a colour channel. Colours are sRGB, as CSS defines them.
What this result means
The result shows the same sRGB colour as HEX, RGB and HSL, with a preview beside the values.
Examples
- #336699: rgb(51, 102, 153) and hsl(210, 50%, 40%)
- #fff: The short form is read as #ffffff, which is rgb(255, 255, 255) and hsl(0, 0%, 100%).
Common mistakes
- Entering a 4- or 8-digit HEX colour with transparency, such as #336699ff. Transparency is not supported, so use the 3- or 6-digit form.
Assumptions and limitations
- HEX, RGB and HSL only, without transparency.
