OKLCH ⇄ HEX, RGB and HSL with a full sRGB → OKLab → OKLCH pipeline, live swatch and sRGB gamut warning — browser-only
- Runs locally
- Category Color & Design
- Best for Moving from a visual idea to reusable color values.
L = lightness (0–100%), C = chroma, H = hue (0–360°)
What this tool does
Free OKLCH color converter for the CSS Color 4 era. Paste a HEX like #1d4ed8, an rgb() string, or a modern oklch(62% 0.17 145) value and read every format back at once, with a live swatch and a one-click copy on each line. Under the hood it runs the real color-science pipeline: sRGB to linear RGB through the standard transfer curve, linear RGB to OKLab with Bjorn Ottosson's published matrices, then OKLab to the polar OKLCH form where L is perceptual lightness, C is chroma and H is hue in degrees. That is what makes OKLCH special: equal steps in L look equally bright to the eye, so palettes and gradients built in OKLCH stay smooth instead of going muddy in the middle the way HSL does. When a color sits outside the sRGB cube the tool flags it and shows the clamped preview, so a wide-gamut value you grabbed from Figma never silently shifts on you. Everything runs in your browser, nothing is uploaded, and the share link reopens the exact color you were working on.
Tool details
- Input
- Numbers
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy + Preview
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- Shareable URL state
- Key settings are encoded in the URL so another person can reopen the same setup.
- Performance budget
- Initial JS <= 10 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Color & Design · Designer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How OKLCH Color Converter fits into your work
Use it while choosing, checking, converting, or documenting colors for real interface work.
Color jobs
- Moving from a visual idea to reusable color values.
- Checking contrast and accessibility before a UI ships.
- Keeping brand, design, and implementation color decisions aligned.
Color checks
- Verify contrast against the actual background, not just a sample swatch.
- Check dark and light themes separately when both exist.
- Copy the final format your design system or codebase expects.
Good next steps
These links move the current task into a more complete workflow.
- 1 Color Converter HEX ⇄ RGB ⇄ HSL ⇄ HSV ⇄ CMYK — instant 5-way conversion, live swatch — browser-only Open
- 2 Color Contrast Checker Color contrast checker — WCAG 2.2 AA/AAA compliance for normal/large text, real-time grade. Open
- 3 Complementary Color Calculator One base color → complementary, split, triadic, tetradic, analogous and monochromatic schemes on the HSL color wheel — copy every HEX, browser-only Open
Real-world use cases
Build a perceptually even tint-and-shade ramp
Take your brand blue, convert it to OKLCH, then hold C and H fixed while stepping L in equal amounts: 30%, 45%, 60%, 75%, 90%. Each step looks like the same brightness jump, so the resulting tints and shades feel evenly spaced. Doing this in HSL drifts the hue and bunches the lights together; OKLCH keeps the family coherent and the steps readable.
Hand off a Figma OKLCH color to a developer as HEX
A designer picks colors in OKLCH inside Figma, but a teammate still targets older browsers and needs a plain HEX fallback. Paste the oklch() value here, copy the HEX, and ship both with a fallback rule. The gamut warning tells you up front whether the OKLCH was wider than sRGB, so the HEX you hand over is an honest match rather than a silent surprise.
Debug a muddy CSS gradient
Your blue-to-yellow gradient slumps through gray in the middle. Drop both endpoints into the converter, read their OKLCH, and you will see the lightness and chroma sag along the sRGB path. Re-express the stops in OKLCH so the lightness stays even, and the dead middle disappears. The tool gives you the exact oklch() strings to paste back into the gradient.
Translate a token system between color formats
A design-token file stores colors as HEX, but the new theming layer wants OKLCH so it can compute hover and active states by nudging L. Run each token through the converter to get its OKLCH triplet, keep the HEX as the legacy value, and your tokens now carry both, ready for math-driven state colors without a separate library.
Common pitfalls
Reading chroma as a percentage. C is an open-ended number, not a 0–100 scale. A typical vivid sRGB color sits near 0.15–0.25, and the ceiling is roughly 0.37. Typing 50 expecting half-saturation gives you a wildly out-of-gamut value that clamps back to something unexpected.
Forgetting hue is in degrees, not the 0–1 chroma scale. H runs 0–360 like a color wheel; 145 is green, 264 is blue. Putting a small decimal there, as if it matched chroma, snaps your color to a red near hue 0 and the result looks nothing like what you intended.
Assuming the HEX you get back always equals your OKLCH exactly. If the converter shows the out-of-gamut warning, the HEX is the clamped nearest sRGB color, not a perfect match. Lower the chroma until the warning clears if you need the HEX and the OKLCH to agree on screen.
Privacy
Every conversion runs as plain JavaScript inside your browser tab: the sRGB-to-linear curve, the OKLab matrices, the polar OKLCH step and the gamut check all happen locally. No color you type is ever uploaded, and nothing is logged. The one caveat is the share link: it encodes your color in the URL query string, so a link pasted into chat records that color in the recipient server's access log. For anything confidential, use the per-line copy buttons instead of sharing the URL.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- ASCII Art Generator Generate ASCII art from text — figlet-style banners, multiple fonts.
- Aspect Ratio Calculator Calculate aspect ratio — fix any 1 of [width, height, ratio], get the other two.
- Avatar Generator Generate avatars from initials, identicons, or random shapes. Download PNG/SVG.
- Base64 Encoder & Decoder Encode or decode Base64 — text, files, and Data URLs. Runs entirely in your browser.