TanodTools
EN

Color converter

Convert HEX, RGB, HSL, HSV and CMYK values and check contrast. CMYK values are approximate and do not use a printer profile.

Runs entirely in your browser

HEX
RGB
HSL
HSV / HSB
CMYK
CSS name

Contrast checker

Contrast ratio –

UseNeedsResult
Normal text, AA4.5:1
Normal text, AAA7:1
Large text, AA3:1
Large text, AAA4.5:1
Icons and UI parts, AA3:1

Reads HEX (3, 4, 6 or 8 digits), rgb(), hsl(), hwb(), hsv(), cmyk(), lab(), lch(), oklab(), oklch(), color() (srgb, display-p3 or rec2020) and CSS colour names; other CSS colour syntax is read by your browser where it can. HSL, HSV and CMYK are shown to one decimal place.

How to convert a colour

  1. Type or paste a colour in any common format, such as #1636a3, rgb(22, 54, 163), hsl(226, 76%, 36%) or navy, or pick one with the colour picker.
  2. Copy the format you need from the list. Values update as you type.
  3. Under Contrast checker, enter a text colour and a background colour to see their contrast ratio and whether they pass WCAG AA and AAA.

Colour formats and contrast

HEX and RGB describe a screen colour as amounts of red, green and blue from 0 to 255; HEX simply writes each amount as two hexadecimal digits, with an optional third pair for opacity. HSL and HSV describe the same colours by hue (an angle around the colour wheel), saturation, and lightness or value, which makes it easier to pick a lighter or duller version of a colour. They are different coordinates for the same sRGB colours, so converting between them is exact apart from rounding.

CMYK is different: it describes ink, and the true conversion depends on the printing process. The figure shown is the naive formula (black is 1 minus the brightest channel, and the other inks make up the rest), useful for rough work but not a substitute for a print profile.

The contrast checker applies the WCAG 2 contrast formula, the one used in accessibility audits and by browser developer tools. It measures luminance contrast only, so it can't tell you about colour-blindness pairs such as red on green, and very thin or small fonts may need more contrast than the minimum.

Tips

Questions

Is the CMYK value right for printing?

Only roughly. The CMYK here is the simple formula that converts screen RGB without a colour profile, which is what most online converters use. Printers work with specific inks and paper, described by an ICC profile, so for print work convert in design software with the profile your printer gives you.

What ratios do AA and AAA require?

Normal text needs 4.5:1 for AA and 7:1 for AAA. Large text, meaning at least 24 px regular or about 18.7 px bold, needs 3:1 for AA and 4.5:1 for AAA. Icons, input borders and other user-interface parts need 3:1 (WCAG 1.4.11). A ratio is not rounded up: 4.49:1 fails AA for normal text.

What happens with a colour outside sRGB?

HEX, RGB, HSL, HSV and CMYK can only describe sRGB colours, and some oklch(), lab() and display-p3 colours lie outside sRGB. Such a colour is brought into sRGB with the CSS Color 4 gamut mapping, which lowers its chroma until it fits and keeps its lightness and hue. The line under the input names the sRGB colour shown.

Why do HSL values change slightly after converting back?

Screen colours have 256 levels per channel, so most HSL and HSV values don't land exactly on one of them. The converter keeps full precision internally and rounds only for display: HEX and RGB to whole numbers, HSL, HSV and CMYK to one decimal place.