RGB/RGBA to Hex Converter
Professional color conversion tool for developers. Converts RGB to Hex, HSL, and CMYK. Includes WCAG accessibility contrast analysis, live preview, and algorithmic palette generation.
#000000 rgba(0,0,0,1) hsl(0, 0%, 0%) cmyk(0%, 0%, 0%, 100%) Algorithmic Harmony
Complementary
Triadic
Analogous
Monochromatic
About
In high-stakes frontend architecture and digital product design, color is data, not just decoration. While screens render light using the RGB (Red, Green, Blue) additive model, production code requires Hexadecimal strings for CSS efficiency, and print media demands CMYK subtraction. A mismatch in these conversions results in brand inconsistency and accessibility violations.
This application functions as a central color logic engine. It goes beyond simple base-16 conversion by calculating the relative luminance of the selected color to determine WCAG 2.1 Compliance. This ensures text legibility and adherence to international web standards. Whether you are defining a design system token or debugging a transparency issue with RGBA, this tool provides the mathematical precision required for production-ready code.
Formulas
The core conversion logic relies on normalizing the integer RGB values [0, 255] to a Hexadecimal string. However, calculating the Relative Luminance (L) for accessibility requires a normalized linear RGB space.
1. RGB to Hex Algorithm:
2. Relative Luminance (WCAG Definition):
Where the linear channel Clin is calculated conditionally:
Reference Data
| Color Token | Hex (8-bit) | RGB Vector | HSL (Cylindrical) | Luminance (L) |
|---|---|---|---|---|
| Absolute Zero | #0048BA | 072186 | 217°, 100%, 37% | 0.089 |
| Crimson Red | #DC143C | 2202060 | 348°, 83%, 47% | 0.160 |
| Emerald | #50C878 | 80200120 | 140°, 52%, 55% | 0.428 |
| Safety Orange | #FF6700 | 2551030 | 24°, 100%, 50% | 0.368 |
| Slate Blue | #6A5ACD | 10690205 | 248°, 53%, 58% | 0.158 |
| Chartreuse | #7FFF00 | 1272550 | 90°, 100%, 50% | 0.760 |
| Deep Pink | #FF1493 | 25520147 | 328°, 100%, 54% | 0.203 |
| Gold Standard | #FFD700 | 2552150 | 51°, 100%, 50% | 0.698 |
| Teal | #008080 | 0128128 | 180°, 100%, 25% | 0.169 |
| Vantablack (Sim) | #010101 | 111 | 0°, 0%, 1% | 0.000 |