RGB to HEX: #8A2BE2

Also known as: CSS blueviolet

Result

rgb(138 43 226) → #8A2BE2

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. base 10 → base 16

    R = 138 = 8×16 + 10 → 8A
    G = 43 = 2×16 + 11 → 2B
    B = 226 = 14×16 + 2 → E2
  2. 2. pairs → HEX

    8A 2B E2 → #8A2BE2

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?