A color code converter lets you express the same color in different notations (HEX, RGB, HSL, HSV/HSB, CMYK) and move between them. All of these models describe the sRGB color space that screens use — so a HEX code and its RGB or HSL equivalent describe the exact same color, just written differently. This tool performs every conversion with standard algorithms, without any external library.
How do you convert a HEX color code to RGB?
#RRGGBB; each two-character block represents one color channel in base 16 (hexadecimal). To convert to base 10: #7C3AED → 7C=124, 3A=58, ED=237, i.e. rgb(124, 58, 237). The three-character shorthand (#RGB) is expanded by repeating each character twice: #F0A → #FF00AA.- RR — the red channel, 00–FF (0–255).
- GG — the green channel, 00–FF (0–255).
- BB — the blue channel, 00–FF (0–255).
- AA (optional) — in an 8-digit HEX, the last block is the alpha (opacity) channel.
What are HSL and HSV? How do they differ from RGB?
In practice, when you want to take a brand color and produce lighter and darker shades of it, HSL is the most useful model: keep the hue (H) and saturation (S) fixed and vary only the lightness (L). The "Tints & shades" palette on this page does exactly that. Design programs' color pickers usually use HSV, because a "brightness" slider is visually easier to grasp.
How is the WCAG contrast ratio calculated?
c ≤ 0.03928 ? c/12.92 : ((c+0.055)/1.055)^2.4. Then L = 0.2126·R + 0.7152·G + 0.0722·B. The contrast ratio is (L1 + 0.05) / (L2 + 0.05) — L1 the lighter, L2 the darker color's luminance. The result falls between 1:1 and 21:1.This formula accounts for the fact that the human eye is most sensitive to green and least sensitive to blue (the 0.7152 and 0.0722 coefficients). That's why even a seemingly "light" pair like yellow-on-white can fail contrast checks. Use the contrast tool above to see the ratio and AA/AAA results live for any two colors.