User Rating 0.0
Total Usage 4 times
Category CSS Tools
Input Channels
Text Text
HEX
#000000
RGBA
rgba(0,0,0,1)
HSL hsl(0, 0%, 0%)
CMYK cmyk(0%, 0%, 0%, 100%)
Accessibility (WCAG 2.1)
Contrast (on White): 21.0:1 AAA
Contrast (on Black): 1.0:1 Fail

Algorithmic Harmony

Complementary

Triadic

Analogous

Monochromatic

Is this tool helpful?

Your feedback helps us improve.

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.

rgb to hex color converter wcag contrast cmyk calculator web design tools css generator color palettes

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:

Hex = # + toBase16(R) + toBase16(G) + toBase16(B)

2. Relative Luminance (WCAG Definition):

L = 0.2126 Rlin + 0.7152 Glin + 0.0722 Blin

Where the linear channel Clin is calculated conditionally:

Clin =
{
CsRGB12.92 if CsRGB 0.040452.4(CsRGB + 0.0551.055 otherwise

Reference Data

Color TokenHex (8-bit)RGB VectorHSL (Cylindrical)Luminance (L)
Absolute Zero#0048BA072186217°, 100%, 37%0.089
Crimson Red#DC143C2202060348°, 83%, 47%0.160
Emerald#50C87880200120140°, 52%, 55%0.428
Safety Orange#FF6700255103024°, 100%, 50%0.368
Slate Blue#6A5ACD10690205248°, 53%, 58%0.158
Chartreuse#7FFF00127255090°, 100%, 50%0.760
Deep Pink#FF149325520147328°, 100%, 54%0.203
Gold Standard#FFD700255215051°, 100%, 50%0.698
Teal#0080800128128180°, 100%, 25%0.169
Vantablack (Sim)#0101011110°, 0%, 1%0.000

Frequently Asked Questions

Digital accessibility is legally and ethically required for modern web development. The Contrast Ratio tells you if your selected background color provides enough contrast against white or black text, ensuring that users with visual impairments can read your content.
RGB (Red, Green, Blue) is an additive color model used for digital screens, where colors are created by adding light. CMYK (Cyan, Magenta, Yellow, Key/Black) is a subtractive model used for printing, where colors are created by masking white paper with ink. This tool provides both to bridge the gap between web and print design.
An alpha value of 0 results in a completely transparent color. In Hex code, this is represented as "00" at the end of the string (e.g., #FFFFFF00). While the RGB values technically still exist, the color will be invisible on the screen unless combined with a backdrop filter.
The tool converts your RGB input into the HSL (Hue, Saturation, Lightness) cylindrical coordinate system. It then adds 180 degrees to the Hue angle to find the exact opposite color on the color wheel, ensuring high visual impact and vibrancy.