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
- Hex#1A8FE3
- RGBrgb(26, 143, 227)
- HSLhsl(205 79% 50%)
- HWBhwb(205 10% 11%)
- CMYKcmyk(89% 37% 0% 11%)
- Luminance (WCAG 2.2)0.2541
- Contrast vs white3.45:1 (AA large only)
- Contrast vs black6.08:1 (AA)
Step-by-step
- Normalise inputs to integer RGB triple (0-255).
- Convert to HSL via the standard chroma/lightness formula; HWB = (hue, min, 1-max).
- Relative luminance: L = 0.2126ยทRโ + 0.7152ยทGโ + 0.0722ยทBโ with sRGB linearisation; contrast = (L1+0.05)/(L2+0.05).
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.