This color converter turns any HEX, RGB or HSL color into the other two formats, shows a large swatch, checks its WCAG contrast against white and black, and builds a row of tints and shades. Pick a color or paste a value and every result updates at once. It runs in your browser with no uploads.

How to use the color converter

  1. Click the Picker to choose a color, or type a value into HEX, rgb() or hsl(). Accepted forms include #1e6fd9, #fff, #1e6fd980, rgb(30, 111, 217), rgba(30 111 217 / 50%) and hsl(214, 76%, 48%).
  2. Read the HEX, RGB and HSL values and click Copy next to the one you need.
  3. Check the contrast results Against white and Against black before using the color for text or buttons.
  4. Click any square under Tints and shades to load that color.

How it works

HEX is just the red, green and blue values (0 to 255) written in base 16, so 1e is 30, 6f is 111 and d9 is 217. HSL describes the same color as a hue angle on the color wheel (0 to 360 degrees), a saturation and a lightness. The tool converts between them with the standard CSS formulas and rounds HSL to whole numbers. An optional fourth value is alpha (transparency), shown as an 8-digit HEX or as rgba() and hsla().

Contrast follows WCAG 2: each color’s relative luminance is calculated from its linearised RGB values, then the ratio is (lighter + 0.05) divided by (darker + 0.05). The ratio runs from 1:1 (no contrast) to 21:1 (black on white). Tints mix the color with white in steps of 20 percent, and shades mix it with black.

Example

Enter #1e6fd9 and the tool shows:

HEX  #1e6fd9
RGB  rgb(30, 111, 217)
HSL  hsl(214, 76%, 48%)
Against white  4.85:1  AA pass (AAA fail)
Against black  4.33:1  AA large text only

The tints and shades row, from lightest to darkest, is:

#d2e2f7 #a5c5f0 #78a9e8 #4b8ce1 #1e6fd9 #1859ae #124382 #0c2c57 #06162b

Note that typing hsl(214, 76%, 48%) back in gives #1d6ed7, one step off, because HSL is rounded to whole numbers. Copy the HEX or RGB value when you need an exact match.

WCAG contrast levels

Ratio Label in the tool Meaning
7:1 or more AAA pass Meets the strictest level for normal text
4.5:1 to 6.99:1 AA pass (AAA fail) Fine for body text at level AA
3:1 to 4.49:1 AA large text only OK for text from 24px, or 18.66px bold, and for icons
Below 3:1 Fail Too faint for text

Common mistakes: judging contrast by eye, forgetting that a transparent color’s real contrast depends on what is behind it, and writing #RRGGBBAA where a tool expects #AARRGGBB (Android uses the latter). If you need hex for other data, the hash generator produces hex digests, and the case converter can upper-case a list of codes.

Frequently asked questions

What is the difference between HEX and RGB?

None in the color itself. HEX writes the same three red, green and blue numbers in base 16, which is shorter to type in CSS.

Why did my HSL value change slightly when converted back?

HSL is rounded to whole degrees and whole percentages, so a round trip can land one step away. Use HEX or RGB for exact values.

Does the contrast check include transparency?

No. It uses the solid color. The real contrast of a see-through color depends on the background behind it.

Which contrast level should I aim for?

Aim for at least 4.5:1 for body text, which is WCAG AA. Large headings need 3:1. AAA (7:1) is better for long reading.

Can I use named colors like red?

Not yet. Type a HEX, rgb() or hsl() value, or use the picker.