HEX to OKLCH: #6B21A8

Also known as: Tailwind v3 purple-800

Result

#6B21A8 → oklch(0.438 0.198 303.7)

Values are shown at full precision, so converting back gives exactly #6b21a8. 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. 1. sRGB → linear

    R: 107/255 = 0.41961 → 0.147027  (((x + 0.055) / 1.055)^2.4)
    G: 33/255 = 0.12941 → 0.015209  (((x + 0.055) / 1.055)^2.4)
    B: 168/255 = 0.65882 → 0.391572  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.088909
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.083562
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.263950
  3. 3. cube root

    l′ = ∛0.088909 = 0.446323
    m′ = ∛0.083562 = 0.437189
    s′ = ∛0.263950 = 0.641466
  4. 4. LMS′ → Oklab

    L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.43828
    a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.11011
    b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.16496
  5. 5. Oklab → OKLCH

    C = √(a² + b²) = 0.19833
    H = atan2(b, a) = 303.724°
    L = 0.43828
  6. 6. OKLCH

    oklch(0.43828 0.19833 303.724)
    rounded: oklch(0.438 0.198 303.7)

All formats

HEX
#6b21a8
RGB
rgb(107 33 168)
RGB (legacy)
rgb(107, 33, 168)
HSL
hsl(272.89 67.16% 39.41%) → hsl(273 67% 39%)
HWB
hwb(273 13% 34%)
OKLCH
oklch(0.438 0.198 303.7) · oklch(43.8% 0.198 303.7)
OKLab
oklab(0.438 0.110 -0.165)
Lab (D50)
lab(31.20 50.29 -58.65)
LCH (D50)
lch(31.20 77.26 310.61)
Display P3
color(display-p3 0.3865 0.1499 0.6344)
Linear sRGB
color(srgb-linear 0.1470 0.0152 0.3916)

Gamut: sRGB and Display P3

#6B21A8 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.229 and Display P3 reaches 0.240; this color uses 87% of the sRGB chroma available.

CSS snippets

.element {
  color: #6b21a8;
  color: rgb(107 33 168);
  color: hsl(273 67% 39%);
  color: oklch(0.438 0.198 303.7);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.438 0.198 303.7);
}
/* arbitrary values */
class="text-[#6b21a8] bg-[oklch(0.438_0.198_303.7)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.3865 0.1499 0.6344); }
}

/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #6b21a8 calc(l - 0.1) c h); }

Nearby colors

Closest colors in the Tailwind and CSS named palettes (OKLab distance).

Lighter and darker, same hue and chroma

  • #7C37BC · oklch(0.498 0.198 303.7) · ΔL +0.06
  • #5A0094 · oklch(0.378 0.198 303.7) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?