Developer Tool

Color Converter (HEX, RGB, HSL)

Pick a colour or type a HEX code and get the matching RGB and HSL values for CSS, design tools and brand guides.

Maintained by Kumara Samigari LokeshMethod: standard sRGB HEX, RGB and HSL conversionMethods and limitations

What this tool does

Choose a colour with the picker or type a six-digit HEX code. The tool shows the same colour as RGB and HSL values, ready to copy into CSS or a design app.

The three formats

  • HEX (#3459EC): red, green and blue as two hexadecimal digits each, from 00 to FF.
  • RGB (rgb(52, 89, 236)): the same three channels as decimal numbers from 0 to 255.
  • HSL (hsl(228, 83%, 56%)): hue as an angle on the colour wheel (0–360°), saturation and lightness as percentages.

Worked example

#3459EC, the blue used on this site, converts to rgb(52, 89, 236) and hsl(228, 83%, 56%). 34 in hex is 3×16 + 4 = 52, which is the red value.

Why HSL is handy

HSL makes it easy to build variations of a colour. Keep the hue and saturation and change lightness to get a lighter tint for backgrounds or a darker shade for hover states: hsl(228, 83%, 90%) is a pale version of the same blue. In RGB you would have to change all three numbers.

Check contrast

For readable text, the contrast between text and background should be at least 4.5:1 for normal text under WCAG guidelines. Light blues and greys on white often fall short. Use a contrast checker before finalising brand colours for text.

Limitations

Only six-digit HEX codes are read. Three-digit shorthand such as #FFF should be expanded to #FFFFFF, and alpha (transparency) values are not supported.

FAQs

How do I convert HEX to RGB?

Split the code into three pairs and convert each from hexadecimal to decimal.

Can I enter #FFF?

Expand it to #FFFFFF first.

Does it support transparency?

No, only opaque colours.

What is the difference between HSL and HSV?

Both use hue, but HSL’s lightness runs from black through the pure colour to white, while HSV’s value runs from black to the pure colour.

Which format should I use in CSS?

All three work. HSL is easiest for making variations; HEX is the most compact.