HEX to OKLCH: #FEF08A

Also known as: Tailwind v3 yellow-200

Result

#FEF08A → oklch(0.945 0.124 101.5)

Values are shown at full precision, so converting back gives exactly #fef08a. 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: 254/255 = 0.99608 → 0.991102  (((x + 0.055) / 1.055)^2.4)
    G: 240/255 = 0.94118 → 0.871367  (((x + 0.055) / 1.055)^2.4)
    B: 138/255 = 0.54118 → 0.254152  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.888971
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.830452
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.493108
  3. 3. cube root

    l′ = ∛0.888971 = 0.961529
    m′ = ∛0.830452 = 0.939950
    s′ = ∛0.493108 = 0.790037
  4. 4. LMS′ → Oklab

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

    C = √(a² + b²) = 0.12430
    H = atan2(b, a) = 101.540°
    L = 0.94510
  6. 6. OKLCH

    oklch(0.94510 0.12430 101.540)
    rounded: oklch(0.945 0.124 101.5)

All formats

HEX
#fef08a
RGB
rgb(254 240 138)
RGB (legacy)
rgb(254, 240, 138)
HSL
hsl(52.76 98.31% 76.86%) → hsl(53 98% 77%)
HWB
hwb(53 54% 0%)
OKLCH
oklch(0.945 0.124 101.5) · oklch(94.5% 0.124 101.5)
OKLab
oklab(0.945 -0.025 0.122)
Lab (D50)
lab(94.34 -4.96 50.75)
LCH (D50)
lch(94.34 51.00 95.58)
Display P3
color(display-p3 0.9866 0.9431 0.5939)
Linear sRGB
color(srgb-linear 0.9911 0.8714 0.2542)

Gamut: sRGB and Display P3

#FEF08A is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.131 and Display P3 reaches 0.152; this color uses 95% of the sRGB chroma available.

CSS snippets

.element {
  color: #fef08a;
  color: rgb(254 240 138);
  color: hsl(53 98% 77%);
  color: oklch(0.945 0.124 101.5);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.945 0.124 101.5);
}
/* arbitrary values */
class="text-[#fef08a] bg-[oklch(0.945_0.124_101.5)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.9866 0.9431 0.5939); }
}

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

  • #FFFF9C · oklch(1.000 0.124 101.5) · ΔL +0.06
  • #EADC76 · oklch(0.885 0.124 101.5) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?