Color Picker (hex / rgb / hsl / hwb)
Convert a color between hex, RGB, HSL, HWB, and CMYK. Reports relative luminance and WCAG 2.2 contrast ratio against white and black.
Result
How to use this calculator
- Pick an input format.
- Read the equivalent representations in the breakdown.
- Use the contrast rows to check WCAG AA (≥4.5:1) or AAA (≥7:1) against your background.
About this calculator
Designers move between hex, RGB, HSL, and HWB depending on context — hex for code, RGB for raster pipelines, HSL for theme tokens, HWB for accessible-design tooling. This converter does all four at once and adds the CSS-modern CMYK approximation plus the WCAG-2.2 contrast ratio against pure white and pure black. The luminance is computed exactly the way browsers and accessibility checkers do it, so the contrast numbers match what axe, Lighthouse, and Stark will report.
How it works — the formula
L = 0.2126·R’ + 0.7152·G’ + 0.0722·B’ (sRGB linear)
contrast = (max(L1,L2)+0.05) / (min(L1,L2)+0.05)The CIE luminance weights match human luminous-efficiency sensitivity. The +0.05 offset prevents division-by-zero and matches CRT ambient-light assumptions baked into the WCAG formula.
Worked examples
- Inputs:
- hex=#1A8FE3
- Output:
- rgb(26,143,227), hsl(207 78% 50%)
- Inputs:
- hex=#FFFFFF
- Output:
- L=1.0, contrast vs black = 21.00:1 (AAA)
- Inputs:
- hex=#808080
- Output:
- L≈0.216, contrast vs white = 3.95:1
Limitations
- CMYK is uncalibrated — use a colour-managed profile for print.
- WCAG contrast is sRGB-display-targeted.
- No APCA (WCAG 3 draft) contrast model.
Conversions use standard W3C / CIE / sRGB formulae and match browser-native colour-conversion behaviour.
Frequently asked
What is the difference between HSL and HWB?+
How is the contrast ratio computed?+
Why is CMYK only approximate?+
What is the WCAG contrast threshold for UI components?+
Does this match what my browser displays?+
Related calculators
More tools you might like
Hand-picked tools that pair well with this one — same audience, same intent.
Convert numbers between hexadecimal, binary, octal, and decimal. Shows the bit pattern grouped by nibble + the two’s-complement representation for negative values.
Calculate what X% of a value is, find what percentage one number is of another, or compute the percentage change between two numbers.
Six-mode percentage tool — X% of Y, X is what % of Y, % change, % difference (symmetric), add %, and subtract %.
Convert a color between HEX, RGB, and HSL formats, with the parsed channel values and CSS-ready strings.
Check the contrast ratio between a text color and background and whether it passes WCAG AA and AAA for normal and large text.
Generate a harmonious color palette — complementary, analogous, triadic, tetradic, or monochromatic — from a base color.