Developer tool

Color Converter

Convert colors between HEX, RGB and HSL: paste a CSS color such as #336699 or rgb(51, 102, 153) and copy it in the other two formats. Free, in your browser.

Your file never leaves your device.

Runs locally in your browser

Your text is not uploaded.

Simple steps

How it works

  1. 01

    Enter a CSS HEX, RGB, or HSL color.

  2. 02

    Review the equivalent values in all three formats.

  3. 03

    Copy the converted color values.

Three ways to write the same colour

HEX writes red, green and blue as two hexadecimal digits each, from 00 to FF: #4F46E5 is red 79, green 70 and blue 229, which is rgb(79, 70, 229). The short form doubles each digit, so #3AF is #33AAFF.

HSL describes the colour as a hue (an angle on the colour wheel from 0 to 360), a saturation and a lightness: #4F46E5 is hsl(243, 75%, 59%). The tool accepts any of these forms and shows all three.

Rounding and round trips

RGB and HEX use whole numbers, and HSL is shown with whole degrees and percentages, so each conversion rounds. Converting the rounded HSL back can therefore land a step away from where you started: hsl(243, 75%, 59%) converts to rgb(80, 72, 229), not the original rgb(79, 70, 229). When an exact colour matters, keep its HEX or RGB value as the reference.

Working with HSL

HSL makes related colours easy: keep the hue, then raise the lightness for a hover state or a background tint, or lower the saturation for a muted version. Check text colours for contrast; WCAG level AA asks for at least 4.5:1 for normal text.

Transparent colours, such as rgba(), hsla() or 8-digit HEX, are not accepted. Enter the colour without its alpha value.

Good to know

Frequently asked questions

Which color syntaxes are accepted?

Enter #RGB or #RRGGBB, rgb(r, g, b), or hsl(h, s%, l%).

Are alpha colors supported?

This converter accepts opaque RGB and HSL colors; alpha channels are not included.

Are results rounded?

RGB channels are rounded to whole numbers; hue, saturation, and lightness are shown as percentages and degrees.

Can I paste CSS variables?

Paste a color value itself, not a variable declaration such as --brand: #336699.

Is the color sent online?

No. Parsing and conversion run locally in your browser.