OKLCH to RGB Converter

Paste an oklch() value or set lightness, chroma and hue to get the matching rgb() value, with a gamut check for colours a standard screen cannot show.

OKLCH Values

Paste a value such as oklch(62.8% 0.258 29.2 / 0.5), or set each part below.

Your colour in RGB

rgb(47, 193, 131)

#2FC183

Gamut check: inside sRGB

Gamut-mapped
rgb(47, 193, 131)
Clipped
rgb(47, 193, 131)

A standard screen can show this colour as written, so both methods leave it unchanged and the result above is exact.

#2FC183 in every format

These chips describe the opaque 8-bit colour, so the OKLCH chip can differ from your input in the last decimals.

From screen to print

The closest Pantone match for this colour

For print, these are the three Pantone Matching System inks closest to rgb(47, 193, 131), the sRGB value your input converts to, on coated (C) and uncoated (U) paper.

  1. Coated
    Uncoated
    Best matchPantone 7479 C95.2% match
  2. Coated
    Uncoated
    Match 2Pantone 6401 C94.3% match
  3. Coated
    Uncoated
    Match 3Pantone 6395 C93.2% match

See all matches in RGB to Pantone

Scores use the same weighted RGB ranking as our Pantone converters, and a printed swatch book is the final check.

Approximate match — not a Pantone-published value.

What L, C and H Become in RGB

Each part of an oklch() value describes appearance, and none of them maps to a single RGB channel:

  • L, lightness (0–100%, or 0–1) — raising it makes the colour lighter, which generally lifts the channels, by amounts that depend on the hue.
  • C, chroma (0 upwards) — at 0, red, green and blue are equal and the result is a grey. The higher C, the further apart the channels.
  • H, hue (0–360°) — decides which channels lead: around 30° red does, around 140° green, around 265° blue.

The default, oklch(72% 0.15 160), is a mid-light green with moderate chroma. Green leads and red trails, giving rgb(47, 193, 131).

OKLCH vs RGB: When Each Is Useful

OKLCH is the format to choose colours in. Its lightness tracks what the eye sees, so equal L means equally light; a palette stepped in L at fixed C and H keeps its hue; and it can name wide-gamut colours outside sRGB.

RGB is the format most other code consumes:

  • canvas drawing, WebGL and image processing work in red, green and blue values;
  • charting libraries, native apps and older stylesheets often accept nothing else;
  • an rgb() value is an exact instruction to a standard screen, useful for screenshots and QA checks.

Converting at the boundary keeps both: tokens authored in OKLCH, and rgb() wherever a tool expects it. Going the other way, the RGB to OKLCH converter turns sampled values into oklch().

Using oklch() in CSS With rgb() Alongside

In a stylesheet, the rgb() result is a fallback written before the oklch() value:

.success {
  background: rgb(47, 193, 131);
  background: oklch(72% 0.15 160);
}

In JavaScript, a canvas or charting call usually wants the rgb() string, while CSS custom properties can stay in OKLCH:

ctx.fillStyle = 'rgb(47, 193, 131)';      // converted value
element.style.setProperty('--success', 'oklch(72% 0.15 160)');

A canvas fillStyle takes the same colour syntax as CSS in a browser that supports oklch(), but charting libraries and native code may not, so rgb() is the safe default outside stylesheets.

Browser Support

oklch() is supported in Chrome and Edge 111+, Safari 15.4+ and Firefox 113+. An older browser skips the oklch() declaration and keeps the rgb() line above it, so the fallback pattern needs no feature detection.

OKLCH to RGB Reference Values

These oklch() values, computed at build time, give white, black, the three sRGB primaries and this site's brand purple. Each is inside sRGB, so it converts to whole channel values exactly.

CSS oklch() values and their rgb() equivalents
Colouroklch()rgb()HEX
Whiteoklch(100% 0 0)rgb(255, 255, 255)#FFFFFF
Blackoklch(0% 0 0)rgb(0, 0, 0)#000000
Redoklch(62.8% 0.25768 29.23)rgb(255, 0, 0)#FF0000
Greenoklch(86.64% 0.29483 142.5)rgb(0, 255, 0)#00FF00
Blueoklch(45.2% 0.31321 264.05)rgb(0, 0, 255)#0000FF
Brand purpleoklch(64.57% 0.23988 316.07)rgb(196, 78, 237)#C44EED

By contrast, oklch(90% 0.12 300) is outside sRGB: gamut mapping gives rgb(230, 210, 255) and clipping gives rgb(234, 204, 255).

How We Calculate

Chroma and hue become OKLab's a and b axes, which go through the inverse of the matrices from Björn Ottosson's OKLab article to linear sRGB, and then through the sRGB gamma curve (D65 white point) to values from 0 to 255.

If any channel falls outside 0–255 by more than 0.02 of a level, the colour is gamut-mapped with the CSS Color 4 algorithm: a binary search on chroma at constant lightness and hue, to a resolution of 0.0001, that stops when clipping changes the colour by less than 0.02 in OKLab. The hue of the result can therefore differ from the input by a few degrees. Channels are then rounded to whole numbers, and alpha is passed through to 3 decimals.

The Pantone panel compares the resulting RGB colour with weighted RGB ranking, as our Pantone converters do, and its matches are approximate.

Frequently Asked Questions

Inside sRGB, yes: the rgb() value is the same colour, rounded to whole channel values, which no one can see. Outside sRGB they can differ. On a standard screen both end up as an sRGB colour, but on a wide-gamut screen such as a recent phone or laptop, the oklch() value can be shown more saturated than any rgb() value allows. That makes rgb() a fallback for such colours, not a replacement.
Carry the alpha over unchanged. oklch(72% 0.15 160 / 0.5) becomes rgba(47, 193, 131, 0.5), or in the newer space-separated syntax rgb(47 193 131 / 0.5). Both forms work in current browsers; rgba() is now an alias of rgb(). Alpha does not take part in the colour conversion, so it never changes.
Because sRGB cannot show that much chroma at 90% lightness. Converted directly, its blue channel would be 290, above the 255 limit, so it has to be brought into range. Gamut mapping gives rgb(230, 210, 255), whose hue is about 305° rather than 300°. If the hue matters more than the chroma, lower C until the gamut check says the colour is inside sRGB.