Tools / Color Converter / OKLCH → HEX

OKLCH to HEX Converter.

OKLCH to HEX renders a perceptual OKLCH color back to a six-digit hex for tools and APIs that don't yet speak oklch(). Because OKLCH can describe colors outside the sRGB gamut, very vivid values are clamped to the nearest displayable hex.

HEX
All formats

    The OKLCH → HEX formula

    Polar → OKLab (a = C·cos H, b = C·sin H) → linear sRGB (inverse matrix + cubes) → gamma-encode → clamp 0-255 → hex.

    Worked example

    Convert oklch(28% 0.07 268):

    1. a = 0.07·cos(268°), b = 0.07·sin(268°)
    2. OKLab → linear sRGB → gamma-encode
    3. Clamp to gamut → rgb(27, 42, 78)
    4. Hex-encode → #1B2A4E

    JavaScript

    // oklchToRgb then rgbToHex (see colorConvert.ts)
    const rgb = oklchToRgb({l:0.28,c:0.07,h:268});
    const hex = rgbToHex(rgb); // "#1B2A4E"

    FAQ

    What happens to out-of-gamut OKLCH colors?

    OKLCH can express more saturated colors than an sRGB screen can show. Those are clamped per-channel to 0-255 on the way to hex, so the hex is the closest in-gamut match, not an exact equal.

    Looking for a combination we don’t have yet?

    Tell us the colour, mood, or palette you were after — it shapes which editorial combinations we add next.