Color Code Converter (HEX ↔ RGB ↔ HSL)

Enter a color as HEX (#FF8800), RGB (255, 136, 0) or HSL. Any of these formats works, and the tool converts it to all the others. You can also pick a color with the color picker.

HEX#2563EB
RGBrgb(37, 99, 235)
HSLhsl(221.2, 83.2%, 53.3%)
HSVhsv(221.2, 84.3%, 92.2%)
CMYKcmyk(84%, 58%, 0%, 8%)

Text contrast (WCAG)

White text
Black text

Tints and shades (click to select)

How to use the Color Code Converter

  1. Click Pick a color to choose a color, or paste a HEX, RGB or HSL value into the Enter a color code box.
  2. The table shows the HEX, RGB, HSL, HSV and CMYK values. Click Copy next to any of them to copy it.
  3. Under text contrast, see whether white text or black text is easier to read on that color.
  4. In the palette below, click a lighter tint or darker shade of the same color to select it.

How to convert HEX to RGB

A HEX code #RRGGBB writes the red, green and blue values as two hexadecimal digits each (00 to FF, which is 0 to 255 in decimal). Split the code into pairs and convert each pair to decimal to get RGB.

#FF8800 → FF = 255, 88 = 136, 00 = 0 → rgb(255, 136, 0)

To go from RGB to HEX, convert each value into two hex digits and join them. 37 → 25, 99 → 63 and 235 → EB, so rgb(37, 99, 235) is #2563EB. A 3-digit HEX code such as #F80 is shorthand: write each digit twice to get #FF8800. If you want to check the hexadecimal math yourself, try the number base converter.

How are HSL, HSV and CMYK different?

FormatWhat it describesWhere it's mostly used
RGB / HEXStrength of the three primary colors of light (0–255)Websites, screen design
HSLHue (0–360°), saturation, lightnessCSS, when you want to adjust only lightness
HSV (HSB)Hue, saturation, value (brightness)Color pickers in graphics apps such as Photoshop
CMYKProportions of four ink colorsPrint

The CMYK values here are approximations calculated from RGB with a standard formula. Real printed color depends on the paper and the printer's color profile, so for important print jobs, check the color specifications your print shop uses.

The 4.5:1 contrast rule and choosing a text color

The Web Content Accessibility Guidelines (WCAG 2.1) recommend a contrast ratio of at least 4.5:1 (level AA) between normal text and its background. Large text (about 24px and up, or 18.66px and up in bold) needs at least 3:1. A ratio of 7:1 or more meets the stricter AAA level.

Contrast is calculated from the relative luminance L of the two colors: (lighter L + 0.05) ÷ (darker L + 0.05). White on black gives the maximum ratio of 21:1. When you choose colors for a button or banner, pick the text color marked AA in the results above, and most people will find it easy to read.

Many organizations aim for WCAG 2.1 AA, and accessibility rules in several countries refer to it, including the ADA and Section 508 in the US, the Equality Act in the UK, the Accessible Canada Act and the Disability Discrimination Act in Australia.

How to use color codes in CSS

You can paste the converted values straight into CSS. All three of these give the same color:

  • color: #2563EB;
  • color: rgb(37, 99, 235);
  • color: hsl(221.2, 83.2%, 53.3%);

For a semi-transparent color, add the opacity after a slash, as in rgb(37 99 235 / 50%), or add two more digits to the HEX code, as in #2563EB80 (80 is about 50% opacity).

Using tints and shades

The palette builds tints by mixing your color with white and shades by mixing it with black. This gives you a set of related colors for hover states, borders, backgrounds and dark-mode variants that all match your main color.

Click any swatch to make it the current color. All the codes and the contrast check then update for that color.

Frequently asked questions

Can I enter a HEX code without the #?
Yes. FF8800 without the # works too. The tool also reads 3-digit HEX codes (F80) and 8-digit HEX codes that include transparency, but it ignores the transparency value.
How do I enter RGB values?
Type rgb(255, 136, 0), or just three numbers separated by commas or spaces, such as 255, 136, 0.
Why are the CMYK values a little different from my design software?
This tool uses a standard formula and no color profile. Photoshop and Illustrator apply a print color profile, so their values can be different.
How do I find the color code of something in a photo?
Upload the photo to the image color picker and click the spot you want. It gives you the HEX code.
Does white or black text work better on my color?
Check the text contrast section. The option with the higher ratio is easier to read, and a ratio of 4.5:1 or more passes WCAG AA for normal text.

Last updated: 2026-10-06