Color Converter
Convert colors between HEX, RGB, HSL, HSV, CMYK, and HWB formats instantly. Includes visual picker, contrast checker, and palette export.
About
Accurate color conversion requires precise arithmetic across non-linear color models. A rounding error of 1 in an R channel shifts the HEX output by a full step, potentially violating brand guidelines or WCAG contrast thresholds. This tool computes bidirectional transforms between six models - HEX, RGB, HSL, HSV, CMYK, and HWB - using the standard cylindrical decomposition where hue H is derived from the channel delta δ = Cmax − Cmin. CMYK values assume a pure mathematical conversion without ICC color profiles. The integrated contrast checker implements the WCAG 2.1 relative luminance algorithm with sRGB linearization, reporting ratios against both white and black backgrounds.
Limitations: CMYK output is device-independent and will differ from print-calibrated values. HSL/HSV hue is undefined when saturation is 0 (achromatic colors). The tool handles these edge cases by defaulting H to 0°.
Formulas
RGB to HSL conversion decomposes the red, green, and blue channels into cylindrical coordinates representing hue, saturation, and lightness.
WCAG 2.1 contrast ratio uses relative luminance L computed from linearized sRGB channels.
Where L1 is the lighter luminance and L2 is the darker. A ratio ≥ 4.5:1 passes AA for normal text. ≥ 7:1 passes AAA.
RGB to CMYK (device-independent):
Where R′, G′, B′ are channels normalized to [0, 1]. K = key (black). When K = 1, all CMY channels are 0.
Reference Data
| CSS Named Color | HEX | RGB | HSL | CMYK |
|---|---|---|---|---|
| Red | #FF0000 | 255, 0, 0 | 0°, 100%, 50% | 0, 100, 100, 0 |
| Lime | #00FF00 | 0, 255, 0 | 120°, 100%, 50% | 100, 0, 100, 0 |
| Blue | #0000FF | 0, 0, 255 | 240°, 100%, 50% | 100, 100, 0, 0 |
| Yellow | #FFFF00 | 255, 255, 0 | 60°, 100%, 50% | 0, 0, 100, 0 |
| Cyan | #00FFFF | 0, 255, 255 | 180°, 100%, 50% | 100, 0, 0, 0 |
| Magenta | #FF00FF | 255, 0, 255 | 300°, 100%, 50% | 0, 100, 0, 0 |
| Orange | #FFA500 | 255, 165, 0 | 39°, 100%, 50% | 0, 35, 100, 0 |
| Purple | #800080 | 128, 0, 128 | 300°, 100%, 25% | 0, 100, 0, 50 |
| Teal | #008080 | 0, 128, 128 | 180°, 100%, 25% | 100, 0, 0, 50 |
| Navy | #000080 | 0, 0, 128 | 240°, 100%, 25% | 100, 100, 0, 50 |
| Coral | #FF7F50 | 255, 127, 80 | 16°, 100%, 66% | 0, 50, 69, 0 |
| SteelBlue | #4682B4 | 70, 130, 180 | 207°, 44%, 49% | 61, 28, 0, 29 |
| Tomato | #FF6347 | 255, 99, 71 | 9°, 100%, 64% | 0, 61, 72, 0 |
| SlateGray | #708090 | 112, 128, 144 | 210°, 13%, 50% | 22, 11, 0, 44 |
| Gold | #FFD700 | 255, 215, 0 | 51°, 100%, 50% | 0, 16, 100, 0 |
| Indigo | #4B0082 | 75, 0, 130 | 275°, 100%, 25% | 42, 100, 0, 49 |
| Crimson | #DC143C | 220, 20, 60 | 348°, 83%, 47% | 0, 91, 73, 14 |
| DarkOliveGreen | #556B2F | 85, 107, 47 | 82°, 39%, 30% | 21, 0, 56, 58 |
| MediumOrchid | #BA55D3 | 186, 85, 211 | 288°, 59%, 58% | 12, 60, 0, 17 |
| Chocolate | #D2691E | 210, 105, 30 | 25°, 75%, 47% | 0, 50, 86, 18 |