Skip to content
Technology·1 min read·

Color converter

Convert a color between HEX, RGB, and HSL and see all three forms of the same color.

The answer

HEX is six hexadecimal digits. RGB is three channels from 0 to 255. HSL is a hue from 0 to 360 and saturation and lightness from 0 to 100. The page prints all three.

Result

HEX

#ff0000

RGB

rgb(255, 0, 0)

HSL

hsl(0, 100%, 50%)

What do you want to do next?

How this works

A three-digit hex code is expanded by doubling each digit. The conversion between RGB and HSL uses the usual geometric formula and rounds the channels to whole numbers.

There is no named-color list and no alpha channel. #ff0000 is pure red: rgb(255, 0, 0) and hsl(0, 100%, 50%). Rounding can move a converted HSL value by one unit when it comes back.

Practical steps

  1. 1

    Choose the form you already have.

  2. 2

    Enter the hex code, the RGB channels, or the HSL values.

  3. 3

    Copy the form you need. The other two describe the same color.

Examples

  • #ff0000

    rgb(255, 0, 0) and hsl(0, 100%, 50%).

Common mistakes

  • ×

    Reading HSL lightness as an RGB channel. Lightness is a percent, not a 0–255 value.

Frequently asked questions

Do I include the hash?

Either way works. #ff0000 and ff0000 are the same color.

Can I enter an alpha value?

No. This converter is for opaque colors.

Continue reading