Loading...
Loading...
Translate any color between HEX, RGB, and HSL with live sliders, an interactive picker, and copy-ready CSS strings — all calculated in your browser.
#1A73E8rgb(26, 115, 232)hsl(214, 82%, 51%)WCAG ratio of this color against pure white and pure black backgrounds.
A color converter translates between the three formats designers and developers use every day: HEX (#RRGGBB) for stylesheets, RGB (red, green, blue 0–255) for canvases and image tooling, and HSL (hue, saturation, lightness) for intuitive editing. They all describe the same point in sRGB color space — they just trade off readability for math. This tool keeps the three in sync as you edit any of them, shows a live swatch, and reports a quick WCAG contrast snapshot so you know whether the color is safe for body text against white or black. Everything runs locally in your browser; no color is ever uploaded or logged.
Paste a HEX value (with or without the leading #), drag the native color picker, or set RGB / HSL channels with the sliders or numeric inputs.
The big swatch and HEX label update on every keystroke or slider drag, so you can see the color before committing to it.
Whichever format you edited, the other two are recomputed instantly in the Copy as section — HEX, rgb(...), and hsl(...) ready to paste into CSS, design tools, or code.
Click Copy on any row to put that string on your clipboard. The button confirms with a checkmark for 1.5 seconds.
The Contrast snapshot shows your color's WCAG ratio against pure white and pure black. If you need full WCAG AA / AAA verdicts against a custom background, jump to the Contrast Checker tool linked below.
HEX → RGB:
R = parseInt(hex[0..1], 16)
G = parseInt(hex[2..3], 16)
B = parseInt(hex[4..5], 16)
RGB → HSL (each channel scaled to 0–1):
max = max(R, G, B); min = min(R, G, B)
L = (max + min) / 2
S = L > 0.5 ? (max − min) / (2 − max − min) : (max − min) / (max + min)
H depends on which channel is max:
R: H = 60 · ((G − B) / (max − min) mod 6)
G: H = 60 · ((B − R) / (max − min) + 2)
B: H = 60 · ((R − G) / (max − min) + 4)HEX is just RGB written in base 16 — three pairs of hex digits, one per channel, packed into a single string. HSL is a perceptual reshaping of the same RGB cube: hue (0–360°) picks a slice of the color wheel, saturation (0–100%) is how vivid versus gray it is, and lightness (0–100%) is how close to white or black it sits. The conversions above are lossless modulo rounding, so HEX ↔ RGB ↔ HSL ↔ HEX should round-trip to the same value.
Reference: CSS Color Module Level 4 — sRGB
| Input | Equivalent formats |
|---|---|
#1A73E8 | rgb(26, 115, 232) · hsl(214, 82%, 51%) Google blue — a popular link / primary-button shade. |
rgb(255, 105, 180) | #FF69B4 · hsl(330, 100%, 71%) CSS named color hot pink, expressed three ways. |
hsl(120, 73%, 75%) | #9EE89E · rgb(158, 232, 158) A pastel green — easy to dial in by lifting the L slider. |
#03A | #0033AA · rgb(0, 51, 170) · hsl(222, 100%, 33%) Three-digit shorthand expands to its six-digit equivalent. |
Test any two colors for WCAG AA and AAA contrast compliance for text and UI.
Calculate your exact age in years, months, and days from any date of birth.
Check body mass index from height and weight using metric or imperial units.
Work out percentages, percentage change, and percentage of a total in seconds.
Last updated