HEX to OKLCH: #663399

Also known as: CSS rebeccapurple

Result

#663399 → oklch(0.440 0.160 303.4)

Values are shown at full precision, so converting back gives exactly #663399. 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: 102/255 = 0.40000 → 0.132868  (((x + 0.055) / 1.055)^2.4)
    G: 51/255 = 0.20000 → 0.033105  (((x + 0.055) / 1.055)^2.4)
    B: 153/255 = 0.60000 → 0.318547  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.088914
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.084901
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.221737
  3. 3. cube root

    l′ = ∛0.088914 = 0.446331
    m′ = ∛0.084901 = 0.439512
    s′ = ∛0.221737 = 0.605265
  4. 4. LMS′ → Oklab

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

    C = √(a² + b²) = 0.16030
    H = atan2(b, a) = 303.373°
    L = 0.44027
  6. 6. OKLCH

    oklch(0.44027 0.16030 303.373)
    rounded: oklch(0.440 0.160 303.4)

All formats

HEX
#663399
RGB
rgb(102 51 153)
RGB (legacy)
rgb(102, 51, 153)
HSL
hsl(270.00 50.00% 40.00%) → hsl(270 50% 40%)
HWB
hwb(270 20% 40%)
OKLCH
oklch(0.440 0.160 303.4) · oklch(44.0% 0.160 303.4)
OKLab
oklab(0.440 0.088 -0.134)
Lab (D50)
lab(32.39 38.42 -47.69)
LCH (D50)
lch(32.39 61.24 308.86)
Display P3
color(display-p3 0.3737 0.2103 0.5791)
Linear sRGB
color(srgb-linear 0.1329 0.0331 0.3185)

Gamut: sRGB and Display P3

#663399 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.231 and Display P3 reaches 0.241; this color uses 69% of the sRGB chroma available.

CSS snippets

.element {
  color: #663399;
  color: rgb(102 51 153);
  color: hsl(270 50% 40%);
  color: oklch(0.440 0.160 303.4);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.440 0.160 303.4);
}
/* arbitrary values */
class="text-[#663399] bg-[oklch(0.440_0.160_303.4)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.3737 0.2103 0.5791); }
}

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

  • #7745AC · oklch(0.500 0.160 303.4) · ΔL +0.06
  • #552086 · oklch(0.380 0.160 303.4) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?