HSL to HEX: #663399
Also known as: CSS rebeccapurple
Result
hsl(270.00 50.00% 40.00%) → #663399
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. input
H = 270.00°, S = 50.00%, L = 40.00%
2. C
C = (1 − |2L − 1|) × S = 0.40000
3. X
X = C × (1 − |(H / 60°) mod 2 − 1|) = 0.20000 (H / 60° = 4.5000, sector 4)
4. m
m = L − C / 2 = 0.20000
5. (R′, G′, B′) + m
(R′, G′, B′) = (0.20000, 0.00000, 0.40000) R = round((0.20000 + 0.20000) × 255) = 102 G = round((0.00000 + 0.20000) × 255) = 51 B = round((0.40000 + 0.20000) × 255) = 153
6. RGB → HEX
#663399
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).
- v3 purple-800#6B21A8
- purple-800#6E11B0
- v3 purple-900#581C87
- darkslateblue#483D8B
- v3 violet-800#5B21B6
- purple-900#59168B
- v3 violet-900#4C1D95
- violet-900#4D179A
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
Guides: What is OKLCH?