HEX to OKLCH: #5B21B6
Also known as: Tailwind v3 violet-800
Result
#5B21B6 → oklch(0.432 0.211 292.8)
Values are shown at full precision, so converting back gives exactly #5b21b6. The rounded form is what you normally paste into CSS.
Step-by-step math
Every number below is computed from the input, nothing is looked up.
1. sRGB → linear
R: 91/255 = 0.35686 → 0.104616 (((x + 0.055) / 1.055)^2.4) G: 33/255 = 0.12941 → 0.015209 (((x + 0.055) / 1.055)^2.4) B: 182/255 = 0.71373 → 0.467784 (((x + 0.055) / 1.055)^2.4)
2. linear sRGB → LMS
l = 0.4122·R + 0.5363·G + 0.0514·B = 0.075348 m = 0.2119·R + 0.6807·G + 0.1074·B = 0.082760 s = 0.0883·R + 0.2817·G + 0.6300·B = 0.308216
3. cube root
l′ = ∛0.075348 = 0.422367 m′ = ∛0.082760 = 0.435785 s′ = ∛0.308216 = 0.675489
4. LMS′ → Oklab
L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.43199 a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.08147 b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.19419
5. Oklab → OKLCH
C = √(a² + b²) = 0.21059 H = atan2(b, a) = 292.759° L = 0.43199
6. OKLCH
oklch(0.43199 0.21059 292.759) rounded: oklch(0.432 0.211 292.8)
All formats
- HEX
- #5b21b6
- RGB
- rgb(91 33 182)
- RGB (legacy)
- rgb(91, 33, 182)
- HSL
- hsl(263.36 69.30% 42.16%) → hsl(263 69% 42%)
- HWB
- hwb(263 13% 29%)
- OKLCH
- oklch(0.432 0.211 292.8) · oklch(43.2% 0.211 292.8)
- OKLab
- oklab(0.432 0.081 -0.194)
- Lab (D50)
- lab(30.04 50.06 -69.00)
- LCH (D50)
- lch(30.04 85.24 305.96)
- Display P3
- color(display-p3 0.3296 0.1436 0.6864)
- Linear sRGB
- color(srgb-linear 0.1046 0.0152 0.4678)
Gamut: sRGB and Display P3
#5B21B6 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.240 and Display P3 reaches 0.248; this color uses 88% of the sRGB chroma available.
CSS snippets
.element {
color: #5b21b6;
color: rgb(91 33 182);
color: hsl(263 69% 42%);
color: oklch(0.432 0.211 292.8);
}
/* Tailwind CSS v4 */
@theme {
--color-brand: oklch(0.432 0.211 292.8);
}
/* arbitrary values */
class="text-[#5b21b6] bg-[oklch(0.432_0.211_292.8)]"
/* wide-gamut screens */
@media (color-gamut: p3) {
.element { color: color(display-p3 0.3296 0.1436 0.6864); }
}
/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #5b21b6 calc(l - 0.1) c h); }Nearby colors
Closest colors in the Tailwind and CSS named palettes (OKLab distance).
- violet-800#5D0EC0
- v3 purple-800#6B21A8
- purple-800#6E11B0
- violet-900#4D179A
- rebeccapurple#663399
- v3 violet-900#4C1D95
- v3 indigo-700#4338CA
- indigo-800#372AAC
Lighter and darker, same hue and chroma
- #6B38CA · oklch(0.492 0.211 292.8) · ΔL +0.06
- #4C00A2 · oklch(0.372 0.211 292.8) · ΔL −0.06
Open in the studio
Other converters for this color
Guides: What is OKLCH?