Color Hex Numbers
Convert, pick, and explore color hex numbers with RGB, HSL, and CMYK values. Interactive color picker with contrast checker and history.
About
Every color displayed on screen resolves to a numeric triplet of red, green, and blue channel intensities in the range 0 - 255. Hexadecimal notation compresses this triplet into a six-character string prefixed with #, where each pair encodes one channel in base-16. A miscoded hex value in CSS or SVG silently fails to render, defaulting to black or inherited color and breaking visual hierarchy without throwing an error. This tool parses any hex input, validates it against the 16,777,216 possible sRGB values, and converts it to RGB, HSL, and CMYK simultaneously. It also computes WCAG 2.1 relative luminance and contrast ratios against white and black backgrounds so you can verify accessibility compliance before shipping.
Formulas
A hex color string #RRGGBB encodes three channel values. Each two-character pair is a base-16 integer converted to decimal:
where R1 is the high nibble and R0 is the low nibble, both in range 0 - 15. The same applies to G and B channels.
RGB to HSL conversion normalizes channels to 0 - 1, then computes:
where Δ = Cmax − Cmin. Hue H depends on which channel is Cmax, computed as a 60° sector offset.
WCAG 2.1 relative luminance uses linearized sRGB:
where each linear channel Clin is obtained by applying the sRGB transfer function: if Csrgb ≤ 0.04045, then Clin = Csrgb12.92, otherwise Clin = ((Csrgb + 0.055) ÷ 1.055)2.4. Contrast ratio = L1 + 0.05L2 + 0.05 where L1 is the lighter luminance.
Reference Data
| Color Name | Hex Code | R | G | B | HSL | Usage Context |
|---|---|---|---|---|---|---|
| White | #FFFFFF | 255 | 255 | 255 | 0°, 0%, 100% | Backgrounds, whitespace |
| Black | #000000 | 0 | 0 | 0 | 0°, 0%, 0% | Text, borders |
| Red | #FF0000 | 255 | 0 | 0 | 0°, 100%, 50% | Errors, alerts |
| Green | #00FF00 | 0 | 255 | 0 | 120°, 100%, 50% | Success states |
| Blue | #0000FF | 0 | 0 | 255 | 240°, 100%, 50% | Links, primary actions |
| Coral | #FF7F50 | 255 | 127 | 80 | 16°, 100%, 66% | CTAs, warm accents |
| Teal | #008080 | 0 | 128 | 128 | 180°, 100%, 25% | Professional themes |
| Gold | #FFD700 | 255 | 215 | 0 | 51°, 100%, 50% | Highlights, premium |
| Slate Gray | #708090 | 112 | 128 | 144 | 210°, 13%, 50% | Secondary text |
| Indigo | #4B0082 | 75 | 0 | 130 | 275°, 100%, 25% | Creative branding |
| Tomato | #FF6347 | 255 | 99 | 71 | 9°, 100%, 64% | Warning, attention |
| Medium Purple | #9370DB | 147 | 112 | 219 | 260°, 60%, 65% | Creative UI |
| Dark Cyan | #008B8B | 0 | 139 | 139 | 180°, 100%, 27% | Medical, science UI |
| Chocolate | #D2691E | 210 | 105 | 30 | 25°, 75%, 47% | Earth tones, organic |
| Steel Blue | #4682B4 | 70 | 130 | 180 | 207°, 44%, 49% | Corporate, dashboards |
| Lime Green | #32CD32 | 50 | 205 | 50 | 120°, 61%, 50% | Eco, nature themes |
| Hot Pink | #FF69B4 | 255 | 105 | 180 | 330°, 100%, 71% | Fashion, playful UI |
| Midnight Blue | #191970 | 25 | 25 | 112 | 240°, 64%, 27% | Dark themes, headers |
| Light Salmon | #FFA07A | 255 | 160 | 122 | 17°, 100%, 74% | Soft CTA, food apps |
| Rebecca Purple | #663399 | 102 | 51 | 153 | 270°, 50%, 40% | CSS named color (2014) |