Color Converter: HEX, RGB, HSL and CMYK with Contrast

Enter a color to get its HEX, RGB, HSL and CMYK values, its WCAG contrast with text and a matching palette.

Convert HEX, RGB, HSL and CMYK and check WCAG contrast

A HEX code is the base-16 form of the three RGB channels (0 to 255): #10B981 is RGB(16, 185, 129), which is HSL(160°, 84%, 39%) and CMYK(91, 0, 30, 27). The tool also computes contrast against white or black text with the WCAG formula: 8.28:1 against black here, level AAA.

Conversions

  • HEX ↔ RGB: each pair of hex digits is one channel (10 = 16, B9 = 185, 81 = 129). Short form #abc is accepted.
  • RGB → HSL: lightness is (max + min) ÷ 2 of the channels scaled to 0-1, saturation depends on max − min, hue on the dominant channel. Values are rounded to whole numbers, so a round trip can shift by one point.
  • RGB → CMYK: K = 1 − max(R, G, B); C = (1 − R − K) ÷ (1 − K), likewise for M and Y. For #10B981: K = 27%, C = 91%, M = 0%, Y = 30%.

WCAG contrast

Each channel is linearised (c ÷ 12.92 below 0.04045, otherwise ((c + 0.055) ÷ 1.055)2.4), then L = 0.2126 R + 0.7152 G + 0.0722 B. Contrast ratio = (Llighter + 0.05) ÷ (Ldarker + 0.05). For #10B981, L = 0.364: 2.54:1 on white, 8.28:1 on black. The tool keeps the better of the two and shows AAA from 7:1, AA from 4.5:1, otherwise “fail”. These are the normal-text thresholds; large text (18 pt, or 14 pt bold) only needs 3:1 for AA and 4.5:1 for AAA, which the tool does not distinguish.

Palette and limits

The palette keeps hue and saturation and varies HSL lightness (95, 80, 60, 40 and 20%). CMYK conversion is purely mathematical, with no ICC profile or ink limit: have your printer validate values for print work. Contrast is only checked against pure white and pure black.

Sources and dates: 4.5:1 and 7:1 thresholds (success criteria 1.4.3 and 1.4.6) and the relative luminance definition from Web Content Accessibility Guidelines (WCAG) 2.2, W3C Recommendation of 12/12/2024 (checked 14/10/2026).

Frequently Asked Questions

What minimum contrast does WCAG require?

Level AA requires at least 4.5:1 for normal text and 3:1 for large text (18 pt, or 14 pt bold). Level AAA raises this to 7:1 and 4.5:1. These thresholds are success criteria 1.4.3 and 1.4.6 of WCAG 2.2.

How do I convert a HEX code to RGB?

Split the code into three pairs and convert each from base 16 to base 10: #10B981 gives 10 = 16, B9 = 185, 81 = 129, so RGB(16, 185, 129). A short form such as #0f8 reads as #00ff88.

Is the RGB to CMYK conversion reliable for print?

It gives a ballpark. The formula K = 1 − max(R, G, B) ignores the ICC profile of the paper and press, so the printed colour can differ from the screen. Ask your printer for values matched to their profile.

Is my colour readable with white text?

Compute (L lighter + 0.05) ÷ (L darker + 0.05). The green #10B981 only reaches 2.54:1 with white, below the 4.5:1 AA threshold, but 8.28:1 with black. The tool picks the more readable text colour automatically.

Is this tool really free?

Yes, all tools on Kristools are 100% free and accessible without registration.

Is my data protected?

Yes. All processing is performed directly and securely inside your browser. No personal data is sent to our servers.