Skip to content

Color converter (HEX, RGB, HSL)

Convert a color between HEX, RGB, HSL and other CSS formats.

Click to open the palette

Formats CSS

HEX (hexadecimal) Standard web code
Invalid format (e.g. #FF0000)
RGB / RGBA Ideal for opacity (alpha)
Invalid format (e.g. rgb(255,0,0) or rgba(255,0,0,0.5))
HSL / HSLA Ideal for themes and gradients
Invalid format (e.g. hsl(0, 100%, 50%))

Which color format should you choose in web design?

In CSS, there are several ways to declare a color. The choice of format often depends on what you are trying to achieve (animations, transparency, global theme). Here is a guide to help you choose:

1. The HEX code (hexadecimal)

Example: #FF5252

This is the original and most widely used format on the web. It is very short and easy to copy and paste from design software such as Figma, Photoshop or Illustrator. It is made of 3 pairs of characters representing the Red, Green and Blue (RGB) values in base 16.
Drawback: It is hard to manipulate mentally (how do you darken #FF5252 by 10% without a tool?).

2. The RGB and RGBA format (red, green, blue, alpha)

Example: rgba(255, 82, 82, 0.5)

This format gives the amount of red, green and blue light on a scale from 0 to 255. It is essential if you need transparency. The A (alpha) adds an opacity channel ranging from 0 (invisible) to 1 (fully opaque).

3. The HSL format (hue, saturation, lightness)

Example: hsl(0, 100%, 66%)

It is the favorite format of modern frontend developers. It matches the way the human brain perceives color:

  • Hue: A degree on the color wheel from 0 to 360 (0 = red, 120 = green, 240 = blue).
  • Saturation: From 0% (gray) to 100% (pure color).
  • Lightness: From 0% (absolute black) to 100% (absolute white).

Advantage: To create a button's "hover" state, you just lower the lightness by 10% in CSS. It is also the perfect format for generating dynamic Dark Modes using CSS variables (custom properties).

More UI / UX tools:

How it works

How to use the color converter

Convert a color between HEX, RGB, HSL and other CSS formats.

  1. Choose a color

    Enter a value or use the picker.

  2. Convert

    All the formats are displayed.

  3. Copy the result

    Copy or download the result in one click.

FreeNo subscription, no hidden limits.
No sign-upOpen the page and use the tool. That’s it.
InstantResults in seconds, on mobile too.
PrivateEverything runs in your browser.

About the color converter

HEX for classic CSS, RGB for transparency, HSL to easily create variations of a hue: each format has its use in web design.

color converter hex to rgb rgb to hex hex to hsl hsl to rgb css color converter color code converter
FAQ

Frequently asked questions about the color converter

How do I convert HEX to RGB?

Each hexadecimal pair is one component: #FF8000 becomes rgb(255, 128, 0).

What is HSL for?

It describes hue, saturation and lightness, which is handy for creating shades.

How do I add transparency?

With rgba() or an 8-digit HEX.

Can I copy in one click?

Yes, every format can be copied.

Esc
↑ ↓ navigateEnter open