Color Converter (HEX, RGB, HSL)

Convert a colour between HEX, RGB, HSL, HSV and CMYK, see its shades, and check its contrast with white and black text.

Free, no sign-up Runs in your browser
We couldn't read that colour. Try #1d4ed8, rgb(29, 78, 216) or hsl(224, 76%, 48%).
Shades (darker to lighter). Click one to use it.
Converted in your browser. Nothing is sent anywhere.

Your colour

AaAa
  • HEX—
  • RGB—
  • HSL—
  • HSV / HSB—
  • CMYK (approximate)—
  • Contrast with white text—
  • Contrast with black text—

AA means a contrast of at least 4.5 : 1 for normal text (WCAG 2.1). Test any pair of colours in our contrast checker.

How to use the color converter

  1. Type or paste a colour in HEX, RGB or HSL, or pick one with the colour picker.
  2. Copy the format you need: HEX and RGB for websites and apps, HSL for making lighter and darker versions in CSS.
  3. Check the contrast before using the colour behind text, and click a shade to explore lighter or darker versions.

How the formats relate

Screens mix red, green and blue light. RGB gives each from 0 to 255. HEX writes the same three numbers in base 16 (00 to ff). HSL describes the same colour as a hue (an angle round the colour wheel: 0° red, 120° green, 240° blue), saturation (how strong) and lightness. HSV (also called HSB) is similar, with "value" instead of lightness, and is used by many design apps' pickers.

HEX → RGB 1d → 1×16 + 13 = 29, 4e → 4×16 + 14 = 78, d8 → 13×16 + 8 = 216 RGB → HSL lightness = (largest + smallest) ÷ 2 of the three values (as 0 to 1) CMYK K = 1 − largest, C = (1 − R − K) ÷ (1 − K), and the same for M and Y

Worked example

#1d4ed8 = rgb(29, 78, 216) = hsl(224, 76%, 48%) (HSL rounded to whole numbers) HSV 224°, 87%, 85% CMYK 87%, 64%, 0%, 15% Contrast with white text: 6.7 : 1 (passes AA) #ffffff = rgb(255, 255, 255) = hsl(0, 0%, 100%) #f00 = #ff0000 = rgb(255, 0, 0) = hsl(0, 100%, 50%)

Frequently asked questions

Why is CMYK marked "approximate"?

The CMYK numbers here use the simple textbook formula. Real printing depends on the printer, ink and paper, which printers handle with colour profiles. Ask your printer for the CMYK values to use, and use these as a starting point.

What's the short HEX code like #f00?

When each pair of digits is a repeated digit, CSS lets you write each pair once: #ff0000 can be written #f00. We accept both and always show the full six-digit version.

Are shades the same as tints?

Strictly, tints add white and shades add black. Our row keeps the hue and saturation and steps the HSL lightness from 10% to 90%, which gives both darker and lighter versions of your colour.

Keep going

Related tools

All Developer tools

Disclaimer: results are estimates for planning only and are not tax, legal or financial advice. Rules and rates vary by country, state and personal situation. Check with a qualified accountant before making decisions. Read the full disclaimer.

Last updated: