Skip to content
MyToolers

Color Converter (HEX, RGB, HSL)

Convert colour codes between HEX, RGB and HSL with a live preview.

  • HEX#12B76A
  • RGBrgb(18, 183, 106)
  • HSLhsl(152, 82%, 39%)

About this tool

Paste a colour code in HEX, RGB or HSL format — or pick a colour visually — and get the same colour in all three formats, ready to copy into CSS, design tools or brand guidelines. A live swatch shows exactly what the colour looks like.

How to use it

  1. Type or paste a colour such as #12B76A, rgb(18, 183, 106) or hsl(152, 82%, 39%), or use the colour picker.
  2. See the colour preview and its HEX, RGB and HSL values.
  3. Copy the format you need.

Good to know

  • Accepts 3- and 6-digit HEX codes, with or without the # sign.
  • RGB and HSL values may be separated by commas or spaces; any transparency (alpha) value is ignored.
  • HSL values are rounded to whole numbers, as most tools display them.

HEX, RGB and HSL explained

HEX writes a colour as three pairs of hexadecimal digits for red, green and blue, from 00 to FF: #1DA851 is a WhatsApp-style green. RGB writes the same three values as numbers from 0 to 255: rgb(29, 168, 81). HSL describes the colour as a hue (0–360° around the colour wheel), saturation and lightness.

When to use which

HEX is the most common in design tools and brand guidelines. RGB is handy in code and when you need transparency (rgba). HSL is the easiest to adjust by hand — keep the hue, lower the lightness for a darker shade or raise it for a lighter tint, which is how designers build matching colour scales.

Readable colours

Text needs enough contrast with its background to be readable, especially on phones outdoors. Dark text on a light background, or white text on a dark colour, is safest; avoid mid-grey text on coloured backgrounds.

Choosing colours that are easy to read

For normal text, the WCAG accessibility guidelines ask for a contrast ratio of at least 4.5:1 against the background, and 3:1 for large text. Bright brand colours such as yellow or light green rarely pass on white — keep them for buttons, icons and highlights, and use a darker shade for text.

Colour formats in CSS

#1da851 and #1DA851 are the same colour, and #fff is shorthand for #ffffff. rgb(29 168 81 / 50%) adds 50% transparency, and hsl() is handy for making a lighter or darker version of a brand colour by changing only the lightness.

Frequently asked questions

What's the difference between HEX and RGB?

They describe the same colour. HEX writes the red, green and blue amounts in base-16 (#12B76A), while RGB writes them as numbers from 0 to 255.

When should I use HSL?

HSL (hue, saturation, lightness) makes it easy to create lighter or darker shades of a colour by changing only the lightness value.