Color Converter + WCAG Contrast

Convert a color between HEX, RGB and HSL live — edit any format and the others update. Then check the WCAG contrast between the text color and the background color.

HEX / RGB / HSL Converter

RGB (0–255)
HSL (H 0–360, S/L 0–100)

WCAG Contrast Checker

Large sample text Normal sample text to evaluate readability.
Contrast ratio

How colors are represented

The same pixel can be described in several ways. HEX (#4f46e5) is the hexadecimal notation used in CSS and HTML. RGB describes the color through three channels (red, green and blue), each from 0 to 255. HSL uses hue (0–360°), saturation and lightness — more intuitive for lightening/darkening or rotating the hue. This tool converts between all three at the same time: edit any field and the others adjust.

What is WCAG contrast?

The WCAG (Web Content Accessibility Guidelines) define a minimum contrast ratio between text and background to ensure readability, including for people with low vision. The ratio ranges from 1:1 (identical colors) to 21:1 (black on white). The calculation follows WCAG 2.x: each sRGB channel is linearized, the relative luminance of each color is combined (0.2126·R + 0.7152·G + 0.0722·B) and (Llight + 0.05) / (Ldark + 0.05) is applied.

CriterionNormal textLarge text
AA (minimum)4.5:13:1
AAA (enhanced)7:14.5:1

"Large text" is defined as at least 18pt (24px) regular, or 14pt (18.66px) bold.

Frequently Asked Questions (FAQ)

Why did the RGB value change slightly after converting to HSL and back?

HSL uses integer values for hue/saturation/lightness, so the round trip can round 1 unit in some RGB channel. This is expected and visually imperceptible.

Does the contrast ratio account for transparency (alpha)?

No. The calculation assumes opaque colors, as WCAG recommends for the base test. For translucent elements, evaluate the effective color already composited over the background.