HEX to HSL: #8A2BE2

Also known as: CSS blueviolet

Result

#8A2BE2 → hsl(271 76% 53%)

Values are shown at full precision, so converting back gives exactly #8a2be2. 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. RGB ÷ 255

    R = 0.5412
    G = 0.1686
    B = 0.8863
  2. 2. max, min, Δ

    max = 0.8863
    min = 0.1686
    Δ = max − min = 0.7176
  3. 3. L

    L = (max + min) / 2 = 0.5275 = 52.75%
  4. 4. S

    S = Δ / (1 − |2L − 1|) = 0.7593 = 75.93%
  5. 5. H

    max is B → H = 60° × ((R − G) / Δ + 4) = 60° × ((0.5412 − 0.1686) / 0.7176 + 4) = 271.15°
  6. 6. HSL

    hsl(271.15 75.93% 52.75%)

All formats

HEX
#8a2be2
RGB
rgb(138 43 226)
RGB (legacy)
rgb(138, 43, 226)
HSL
hsl(271.15 75.93% 52.75%) → hsl(271 76% 53%)
HWB
hwb(271 17% 11%)
OKLCH
oklch(0.534 0.250 301.4) · oklch(53.4% 0.250 301.4)
OKLab
oklab(0.534 0.130 -0.214)
Lab (D50)
lab(41.21 63.01 -75.96)
LCH (D50)
lch(41.21 98.69 309.68)
Display P3
color(display-p3 0.4992 0.1957 0.8535)
Linear sRGB
color(srgb-linear 0.2542 0.0242 0.7605)

Gamut: sRGB and Display P3

#8A2BE2 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.283 and Display P3 reaches 0.295; this color uses 89% of the sRGB chroma available.

CSS snippets

.element {
  color: #8a2be2;
  color: rgb(138 43 226);
  color: hsl(271 76% 53%);
  color: oklch(0.534 0.250 301.4);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.534 0.250 301.4);
}
/* arbitrary values */
class="text-[#8a2be2] bg-[oklch(0.534_0.250_301.4)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.4992 0.1957 0.8535); }
}

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

  • #9C44F7 · oklch(0.594 0.250 301.4) · ΔL +0.06
  • #7901CD · oklch(0.474 0.250 301.4) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?