OKLCH Color Picker and Converter
Choose a colour by lightness, chroma and hue, or paste any CSS colour, and get every format with sRGB and Display P3 gamut checks, the CSS Color 4 gamut-mapped fallback, a lightness ramp with contrast figures and ready-made custom properties.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Enter a colour
Paste any CSS colour, pick an example or drag in the lightness-chroma plane.
- 2Fine tune
Move the L, C, h and alpha sliders or type exact values.
- 3Check the gamut
Read the sRGB and P3 notes and push chroma to the maximum if you like.
- 4Copy formats
Copy OKLCH, OKLab, hex, RGB, HSL or Display P3, or CSS with a fallback.
- 5Build a ramp
Set steps, lightness range, chroma mode and hue shift, and check contrast.
- 6Export
Copy or download the custom properties, design tokens JSON or CSV, or print swatches.
About this tool
OKLCH describes a colour by perceived lightness L from 0 to 1, chroma C for colourfulness and hue h in degrees. Unlike HSL, equal steps in OKLCH lightness look like equal steps to the eye, and changing the hue keeps the lightness steady, which is why design systems and CSS frameworks have moved their palettes to it. This picker shows the colour plane at the current hue with lightness across and chroma upwards, painted pixel by pixel from the conversion maths. The plain area fits ordinary sRGB screens, the striped band fits only wide-gamut Display P3 screens, and the checkerboard shows colours no common screen can produce. Drag in the plane or use the three sliders, each with a live gradient, or paste any CSS colour: hex with or without alpha, rgb(), hsl(), hwb(), oklch(), oklab(), color(srgb ...), color(display-p3 ...) or a colour name. The conversions follow the sample code published with CSS Color Module Level 4, including its exact sRGB and P3 matrices and the OKLab matrices by Björn Ottosson. When a colour falls outside sRGB, the tool applies the gamut-mapping algorithm from the same specification, lowering chroma with a binary search until the clipped colour is within a just noticeable difference, and gives you that hex as the fallback. Buttons push chroma to the sRGB or P3 maximum at the current lightness and hue.
Building a palette from one colour
The ramp tab turns the current colour into a scale such as 50 to 950. Lightness is spaced evenly between the lightest and darkest values you set; chroma can stay fixed, taper towards the ends where colours run out of room, or follow the sRGB maximum; and an optional hue shift warms or cools the dark end. Each step shows its hex fallback, its OKLCH value, whether it fits sRGB and its WCAG 2 contrast ratio on white and on black, so you can see at a glance which steps can carry body text. The export writes CSS custom properties with hex values for every browser and the oklch values inside an @supports block, or either one alone, plus design tokens as JSON and a CSV.
Worked example
Type #0d9488, a teal. It reads as oklch(60.02% 0.1038 184.7), OKLab lightness 60.02% with a = −0.1035 and b = −0.0085, rgb(13 148 136), hsl(174.7 83.9% 31.6%) and color(display-p3 0.2622 0.5716 0.5328). It sits inside sRGB. The reference primaries check out to the published values: #ff0000 gives oklch(62.8% 0.2577 29.23), #00ff00 gives oklch(86.64% 0.2948 142.5) and #0000ff gives oklch(45.2% 0.3132 264.05). Now paste color(display-p3 0 1 0): it is oklch(84.88% 0.3685 145.64), outside sRGB but inside P3, and the gamut-mapped sRGB fallback is #00fb29. Back on the teal, an 11-step tapered ramp from L 0.97 to 0.25 gives a 500 step of #15978b with a contrast of 3.60 on white and a 600 step of #008075 at 4.84, the first that passes 4.5 for body text.
Limits
The picture of the plane is drawn in sRGB, so on a wide-gamut screen the striped P3 band is shown at its mapped colour, not its true colour. Contrast figures use WCAG 2 and the sRGB fallback, not APCA. The tool does not manage ICC profiles for print.
Worked example
#0d9488 = oklch(60.02% 0.1038 184.7); P3 green maps to #00fb29; ramp step 600 #008075 has 4.84:1 on white.
Quick facts
- Category: Developer & Data
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in English.
- Content last reviewed:
- Official source: W3C CSS Color Module Level 4
Frequently asked questions
Why use OKLCH instead of HSL?
HSL lightness is not perceptual: hsl yellow and hsl blue at 50% lightness look very different in brightness. OKLCH lightness matches what the eye sees, so ramps and hover states made by changing L look even across hues.
What does out of gamut mean?
The colour cannot be shown on that kind of screen because one of its red, green or blue channels would be below 0 or above 1. The tool shows the raw channel values and gives the closest colour that fits, keeping lightness and hue.
Can browsers use oklch() today?
Current versions of Chrome, Edge, Firefox and Safari support oklch() in CSS. The export still writes a hex fallback first, so older browsers show the mapped sRGB colour and newer ones use the oklch value.
How is the hex fallback chosen?
With the CSS Color 4 gamut-mapping algorithm. It keeps lightness and hue, searches for the highest chroma that still clips to within a deltaE OK of 0.02, and uses that colour, which avoids the hue shifts of plain clipping.
Are the conversions accurate?
They use the matrices and transfer functions from the CSS Color 4 sample code, and the primaries match published reference values to four decimal places. Values are rounded only for display.
Can I save colours for later?
Press Save colour to keep up to 40 colours in this browser, load any of them back with one tap, copy them, or download the list as CSS custom properties. Undo and redo cover every change.
