OKLCH to HEX converter

To convert OKLCH to HEX, turn oklch(L C H) into OKLab, then into linear sRGB and gamma-encoded RGB, and write each channel as two hex digits: oklch(62.8% 0.258 29.23) is #ff0000. Colours outside the sRGB gamut are pulled back in by lowering chroma to the nearest displayable HEX.

To convert OKLCH to HEX, the oklch() value is turned into OKLab, then linear sRGB, then 0-255 channels written as a HEX code; colours outside sRGB are pulled back in by lowering chroma. Paste an oklch() value below.

54.6
0.24499998152884708
263
OKLCHoklch(54.6% 0.245 262.9)
HEX#155dfc
RGBrgb(21, 93, 252)
HSLhsl(221, 97%, 54%)

Tailwind CSS v4 colors: OKLCH to HEX

Tailwind CSS v4 palette values converted with the same OKLCH to sRGB maths the tool uses.
Nameoklch()HEXrgb()In sRGB?
red-500oklch(63.7% 0.237 25.331)#fb2c36rgb(251, 44, 54)Yes
orange-500oklch(70.5% 0.213 47.604)#fc7100rgb(252, 113, 0)outside sRGB, clipped
amber-500oklch(76.9% 0.188 70.08)#f69e00rgb(246, 158, 0)outside sRGB, clipped
green-500oklch(72.3% 0.219 149.579)#00c65argb(0, 198, 90)outside sRGB, clipped
blue-500oklch(62.3% 0.214 259.815)#3280ffrgb(50, 128, 255)outside sRGB, clipped
violet-500oklch(60.6% 0.25 292.717)#8d56ffrgb(141, 86, 255)outside sRGB, clipped
pink-500oklch(65.6% 0.241 354.308)#f6339argb(246, 51, 154)Yes
slate-500oklch(55.4% 0.046 257.417)#62748ergb(98, 116, 142)Yes

How OKLCH to HEX conversion works

  1. Read lightness, chroma and hue from the oklch() value, then convert OKLCH to OKLab.
  2. Transform OKLab into linear sRGB and apply the sRGB gamma curve to get red, green and blue channels.
  3. Round each channel to 0–255 and write those three bytes as a six-digit HEX code, such as #2b7fff.

Why some OKLCH colors have no exact HEX

OKLCH can describe colours outside sRGB, but HEX can only encode sRGB channels from 0 to 255. If a computed channel falls outside that range, there is no exact HEX equivalent. This converter keeps the lightness and hue and lowers the chroma until the colour fits, then labels the result so you know it is a clipped sRGB fallback.

OKLCH to HEX questions

How do I convert OKLCH to HEX?

Paste the oklch() value into the converter above. It turns OKLCH into OKLab, then linear sRGB, and finally rounds the red, green and blue channels to 0–255 values written as a HEX code.

Why does my OKLCH color change when converted to HEX?

The colour is outside the sRGB range that HEX can represent. The converter lowers its chroma until it fits sRGB while keeping the lightness and hue, so the HEX code is the nearest displayable fallback rather than an exact match.

Can I use oklch() directly in CSS?

Yes. All current major browsers support oklch(), so you can use it directly for modern CSS. Convert it to HEX when a design tool, older browser or another system needs an sRGB code.

How do I get the HEX of a Tailwind v4 color?

Copy the oklch() value from your Tailwind CSS v4 theme or generated CSS, then paste it into the converter above. The table also lists the HEX equivalents for eight common Tailwind v4 500-step colours.

Related tools

More color tools

Image tools

CSS generators

Image & SVG tools

Typography & units

More free tools

All free tools