HEX to OKLCH: #9400D3

Also known as: CSS darkviolet

Result

#9400D3 → oklch(0.515 0.261 309.8)

Values are shown at full precision, so converting back gives exactly #9400d3. 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: 148/255 = 0.58039 → 0.296138  (((x + 0.055) / 1.055)^2.4)
    G: 0/255 = 0.00000 → 0.000000  (÷ 12.92)
    B: 211/255 = 0.82745 → 0.651406  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.155587
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.132712
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.436521
  3. 3. cube root

    l′ = ∛0.155587 = 0.537846
    m′ = ∛0.132712 = 0.510078
    s′ = ∛0.436521 = 0.758581
  4. 4. LMS′ → Oklab

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

    C = √(a² + b²) = 0.26067
    H = atan2(b, a) = 309.811°
    L = 0.51491
  6. 6. OKLCH

    oklch(0.51491 0.26067 309.811)
    rounded: oklch(0.515 0.261 309.8)

All formats

HEX
#9400d3
RGB
rgb(148 0 211)
RGB (legacy)
rgb(148, 0, 211)
HSL
hsl(282.09 100.00% 41.37%) → hsl(282 100% 41%)
HWB
hwb(282 0% 17%)
OKLCH
oklch(0.515 0.261 309.8) · oklch(51.5% 0.261 309.8)
OKLab
oklab(0.515 0.167 -0.200)
Lab (D50)
lab(38.79 70.43 -71.24)
LCH (D50)
lch(38.79 100.18 314.67)
Display P3
color(display-p3 0.5307 0.0988 0.7967)
Linear sRGB
color(srgb-linear 0.2961 0.0000 0.6514)

Gamut: sRGB and Display P3

#9400D3 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.261 and Display P3 reaches 0.276; this color uses 100% of the sRGB chroma available.

CSS snippets

.element {
  color: #9400d3;
  color: rgb(148 0 211);
  color: hsl(282 100% 41%);
  color: oklch(0.515 0.261 309.8);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.515 0.261 309.8);
}
/* arbitrary values */
class="text-[#9400d3] bg-[oklch(0.515_0.261_309.8)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.5307 0.0988 0.7967); }
}

/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #9400d3 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

  • #A72CE8 · oklch(0.575 0.261 309.8) · ΔL +0.06
  • #8200BE · oklch(0.455 0.261 309.8) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?