Free tool Runs in your browser; your data never reaches us.

Color Converter: HEX, RGB and HSL Color Codes

Convert HEX, RGB and HSL color codes into each other, preview the color and check how readable it is on white or black (WCAG contrast ratio).

HEX
RGB
HSL
Adjust with sliders
AaAa
On white
On black

Contrast ratios follow WCAG 2: at least 4.5:1 (AA) is recommended for body text and 3:1 for large text.

How to use it

  1. Pick a color with the color picker or type a color code: #7b2d9b, rgb(123, 45, 155) or hsl(283, 55%, 39%).
  2. Its HEX, RGB and HSL values appear right away; press "Copy" to take the one you need.
  3. Use the sliders to fine-tune and check the contrast ratios on the right.

Frequently asked questions

What is the difference between HEX, RGB and HSL?

All three describe the same color in different ways. HEX writes the red, green and blue values as hexadecimal numbers and is the most common format in CSS. RGB writes the same values as numbers from 0 to 255. HSL describes the color as hue, saturation and lightness, which makes lighter or darker shades easy to find.

Is transparency (alpha) supported?

Yes. 8-digit HEX (#ff000080), rgba() and hsla() codes are read and converted with their transparency kept.

Why does the contrast ratio matter?

When text and background have low contrast, the text is hard to read. The WCAG 2 accessibility guidelines recommend at least 4.5:1 for body text and 3:1 for large text. The tool works out the ratio of your color on white and on black.