Convert color values between HEX, RGB, RGBA, HSL, and OKLCH with a live preview swatch — entirely in your browser with no server involved.
Paste or type any color value into the input field, or click the preview swatch to open a visual color picker. The tool auto-detects the format, shows a live preview swatch, and outputs the color in all six formats simultaneously.
Supported input formats:
| Format | Example |
|---|---|
| HEX 6 | #7ee8a2 |
| HEX 8 | #7ee8a280 |
| RGB | rgb(126, 232, 162) |
| RGBA | rgba(126, 232, 162, 0.5) |
| HSL | hsl(141, 69%, 70%) |
| HSLA | hsla(141, 69%, 70%, 0.5) |
| OKLCH | oklch(0.8412 0.1154 151.98) |
The large preview bar above the input shows the parsed color. A checkerboard pattern is rendered underneath to make transparency (alpha < 1) visible. If the input is empty or invalid, the swatch is blank.
Clicking the swatch opens a visual color picker. The selected color is written into the text input as rgb(...) or rgba(...) (the latter when the picker returns an alpha value), and all output cards update immediately.
A format badge next to the swatch shows which format was detected from the input string.
Six cards display the color in every supported format:
#rrggbb (alpha is dropped)#rrggbbaa (alpha encoded as the last two hex digits)rgb(r, g, b)rgba(r, g, b, a)hsl(h, s%, l%) or hsla(...) when alpha < 1oklch(L C H) — a perceptually uniform format from the CSS Color 4 specEach card has a Copy button that copies the formatted value to your clipboard. The button briefly shows Copied! to confirm.
If the input is empty or invalid, all Copy buttons are disabled.
If you type something that cannot be parsed as a color, the input gets a red border. No output is shown until the value is valid or cleared.
All conversions use a canonical internal representation of { r, g, b, a } (r/g/b as integers 0–255, a as a float 0–1). Format conversions go through this intermediate type.
OKLCH conversion follows the full CSS Color 4 pipeline:
C = √(a²+b²), H = atan2(b,a) in degrees)All math runs client-side. No data leaves your browser.
Every color you enter is reflected into the URL as ?color=<encoded-value>. You can share or bookmark these URLs to reopen the converter with the same color pre-filled.