HEX / RGB Color Converter

Convert colours between HEX, RGB and HSL, preview them, and check text contrast.

Runs in your browser. Nothing you enter is sent to our servers.

3 or 6 hexadecimal digits, with or without #.

RGB

Whole numbers from 0 to 255.

Copy as

  • HEX#C45F40
  • RGBrgb(196, 95, 64)
  • HSLhsl(14, 53%, 51%)

Preview

White text on this colour
—
Black text on this colour
—

Contrast ratios follow the WCAG formula. AA needs 4.5:1 for normal text and 3:1 for large text.

How to use this tool

Enter a HEX code such as #C45F40, or type red, green and blue values from 0 to 255. Every field updates to match, along with the preview.

Short HEX codes such as #fa3 are accepted and expanded. The contrast figures show how readable black or white text is on your colour.

Questions and answers

What is the difference between HEX and RGB?

They describe the same thing in different notation. RGB gives the red, green and blue channels as numbers from 0 to 255. HEX writes the same three numbers in base 16, two digits per channel, after a # sign.

What do the contrast ratios mean?

They follow the WCAG formula for the contrast between text and its background, from 1:1 (no contrast) to 21:1 (black on white). WCAG level AA asks for at least 4.5:1 for normal text and 3:1 for large text.

Why does HSL sometimes change slightly when I convert back?

HSL values are rounded to whole numbers for display, and several nearby HSL values can map to the same RGB colour. The HEX and RGB values are always exact.