HEX, RGB and HSL color converter
Convert RGB to HEX and back, inspect HSL and copy a color for CSS. Use one visible sample to compare the results of each conversion.
#336699rgb(51 102 153)hsl(210 50% 40%)How RGB turns into HEX
In #336699, three character pairs encode red, green and blue channels: 3316 = 51, 6616 = 102, 9916 = 153. Therefore, RGB(51, 102, 153) and #336699 describe one sRGB color. The shorthand #369 expands to #336699.
Why HSL sometimes returns another HEX
HSL is calculated from the same channels, but the rounded values lose some of the accuracy. For example, for #C96A51, the exact tone is about 12.5°, the saturation is about 52.63%, the lightness is about 55.29%. If you round everything up to 13°, 53%, 55%, you get #C96A4F. Here, HSL is shown to within four decimal places; when you enter the channels, you round up to an 8-bit RGB.
Opaque sRGB colors are supported: three- or six-digit HEX, integer RGB channels and fractional HSL values. Alpha, CMYK and physical paint matching are outside this tool’s scope.
Find a combination on the color wheel