OKLCH Color Converter: Modern CSS Color Level 4 Made Simple
Learn how the OKLCH Color Converter translates between OKLCH, OKLab, and HEX/RGB/HSL with live preview and gamut clamping for modern CSS Color Level 4.
Table of Contents
For decades, web colors have been described in formats designed for machines rather than people. HEX codes are compact, RGB maps to display hardware, and HSL adds a little intuition β but none of them tell you how a color will actually look relative to another. Nudge the hue in HSL and the perceived brightness drifts. Lighten a color and its apparent vividness shifts too. That mismatch is exactly what OKLCH was built to solve.
The OKLCH Color Converter translates between OKLCH, OKLab, and sRGB formats β HEX, RGB, and HSL β with a live preview swatch and automatic gamut clamping. Everything runs in your browser, so you can explore CSS Color Level 4 syntax without installing anything or creating an account.
Whether you are migrating a design system to modern CSS, tuning a brand palette, or simply curious what oklch(0.624 0.153 257) looks like, this guide explains how the converter works and how to get the most from it.
Why Use the OKLCH Color Converter?
- Perceptually meaningful controls. Lightness, chroma, and hue correspond to how humans actually see color, so slider adjustments produce predictable results.
- All formats at once. Every adjustment instantly shows OKLCH, OKLab, HEX, RGB, and HSL side by side β no more juggling single-purpose tools.
- Gamut-safe output. Out-of-sRGB colors are detected and clamped automatically, so the HEX and RGB values you copy always render correctly on screen.
- Instant HEX round-trips. Paste any existing hex code to see its OKLCH coordinates, then tweak from there.
- Future-proof CSS. OKLCH is a first-class citizen of CSS Color Level 4 and is supported by every major browser, so the values you produce today will keep working.
- Zero friction. 100% client-side, free, and no signup β open the page and start converting.
Key Features
| Feature | What it does |
|---|---|
| Live L/C/H sliders | Adjust Lightness (0β1), Chroma, and Hue (0β360Β°) with an instant preview swatch |
| HEX input | Paste a hex code (default #3b82f6) and get its OKLCH equivalent immediately |
| Simultaneous outputs | See oklch(...), oklab(...), HEX, rgb(...), and HSL at the same time |
| Gamut clamping | Binary-searches the maximum in-gamut chroma (~0.0001 precision over 15 iterations) and warns when a color falls outside sRGB |
| Preset swatches | 10 Tailwind-inspired starting points: red, orange, yellow, green, cyan, blue, violet, pink, slate, and dark navy |
| One-click copy | Copy any output value to the clipboard, or reset back to the default color |
| Client-side privacy | All conversions happen locally in your browser β no data leaves your machine |
A few details worth highlighting:
- The gamut warning is informational, not blocking. When a color exceeds the sRGB gamut, the preview and HEX/RGB outputs show the clamped result with chroma reduced, while the OKLCH readout keeps your original values so you can see exactly how far you went.
- Clamping preserves hue and lightness. The binary search reduces chroma only, so an over-saturated blue stays the same blue β just renderable.
- Presets double as a learning aid. Clicking through the Tailwind-inspired palette shows how hue angles map to familiar colors.
How to Use
- Start from a preset or a hex code. Click one of the 10 swatches, or paste your own color into the HEX input box β it is parsed and converted instantly.
- Adjust the sliders. Move Lightness, Chroma, and Hue while watching the live preview swatch update in real time.
- Check the gamut warning. If the color falls outside sRGB, a warning appears and the displayed HEX/RGB values are gamut-clamped.
- Compare formats. Read the OKLCH, OKLab, HEX, RGB, and HSL values shown simultaneously for the same color.
- Copy what you need. Use the one-click copy button next to any value to drop it straight into your CSS or design tool, or hit reset to return to the default #3b82f6.
Understanding OKLCH and Perceptual Color
OKLCH is the cylindrical form of OKLab, a color space published by BjΓΆrn Ottosson in 2020. Ottosson set out to build a space where numerical distance matches perceived difference β the property known as perceptual uniformity. The three coordinates are:
- L (Lightness), 0 to 1. 0 is pure black and 1 is pure white. A step from 0.5 to 0.6 looks like the same amount of lightening no matter which hue you are working with.
- C (Chroma). How colorful the color is, from 0 (fully gray) upward. In practice, sRGB colors rarely exceed about 0.32, and most UI colors live between 0.05 and 0.2.
- H (Hue), 0 to 360 degrees. The angle around the color wheel β 0 is reddish, roughly 140 is green, and roughly 260 is blue.
Why not HSL? HSL was a clever geometric rearrangement of RGB from the 1970s, but it is not perceptual. In HSL, hsl(60 100% 50%) (yellow) looks dramatically brighter than hsl(240 100% 50%) (blue), even though both have "lightness" of 50%. Rotating hue in HSL produces muddy greens and blazing yellows. OKLab fixes this by modeling color the way human vision works: it converts RGB into approximate cone responses (LMS), applies a cube-root nonlinearity that mimics lightness perception, and derives opponent axes a (greenβred) and b (blueβyellow). OKLCH simply expresses those a/b axes as a radius (chroma) and an angle (hue).
Why browsers chose it. When the CSS Working Group defined Color Level 4, they needed a perceptually uniform space for gradients, interpolation, and color manipulation. After evaluating candidates β including CIELAB and display-oriented spaces β Chrome, Safari, and Firefox all shipped OKLab/OKLCH support in 2023. OKLab is the default interpolation space for CSS gradients, and oklch() is now valid syntax in every major rendering engine.
What gamut clamping means. OKLCH can describe colors that sRGB displays cannot produce β typically highly chromatic colors at medium lightness. The converter detects this and runs a binary search over 15 iterations to find the maximum chroma that still fits inside the sRGB gamut, accurate to about 0.0001. Hue and lightness are preserved; only chroma is reduced. That is the same family of techniques browsers use when rendering wide-gamut colors on standard displays.
Practical Use Cases
Building a design system palette
Generate a full ramp of a brand color by holding hue and chroma steady while stepping lightness: oklch(0.95 0.04 260) through oklch(0.30 0.09 260) gives a tint-to-shade scale where every step looks evenly spaced β something that is painful to achieve by hand-editing HEX values.
Predictable hover and active states
Instead of guessing hex darkening values, drop lightness by 0.05β0.1 for hover states. Because L is perceptual, the change reads consistently across every hue in your UI, from red error states to blue primary buttons.
Migrating legacy palettes to modern CSS
Paste each legacy HEX value into the converter to get its OKLCH coordinates. The resulting oklch() values slot directly into CSS Color Level 4 syntax, and you will often discover that "identical" brand colors differ slightly in chroma or hue β useful intelligence before a redesign.
Learning how color actually works
The preset swatches and live sliders make the tool a compact color-theory lesson: watch how hue 257 reads as blue, how chroma above roughly 0.2 triggers gamut warnings at certain lightness levels, and how lightness dominates perceived contrast.
Best Practices
- Keep UI chroma modest. Most accessible interface colors sit between 0.05 and 0.2 chroma; extreme values are usually out of the sRGB gamut anyway.
- Treat lightness as your contrast lever. Differences in L correlate with perceived contrast, so use them to guarantee readable text and visible boundaries.
- Copy the clamped HEX when targeting sRGB. If the gamut warning is showing, the clamped HEX/RGB values are what will actually render on standard displays.
- Round sensibly. Three decimals for L and C (as in oklch(0.624 0.153 257)) is plenty of precision for CSS.
- Verify contrast separately. Perceptual uniformity helps, but WCAG contrast still needs checking β pair this tool with a dedicated contrast checker.
- Use presets as anchors. Starting from the Tailwind-inspired swatches keeps experiments in a proven, gamut-safe region of the color space.
Start Converting Colors the Perceptual Way
OKLCH is how the modern web describes color, and the OKLCH Color Converter is the fastest way to build intuition for it. Slide, clamp, compare five formats at once, and copy production-ready values β free, private, and entirely in your browser. Open the tool and turn your next palette decision into a precise one.
Related Tools You Might Like:
- OKLCH Contrast Checker β verify text and UI contrast ratios directly in OKLCH space.
- Color Converter β convert between HEX, RGB, HSL, and more classic formats in one place.
- Color Palette Generator β generate harmonious multi-color palettes for your next project.
Happy converting!