ColorToolkits
Format Converter

Hex to OKLCH Converter

Convert legacy HEX strings into modern perceptual CSS OKLCH coordinates with Display-P3 awareness and Tailwind v4 variable formatting.

Converted (OKLCH)
oklch(0.585 0.204 277.1)
#6366F1
Try presets:

How to Use This Tool

  1. Enter or paste your HEX value or choose one of the curated preset swatches.
  2. Copy the formatted OKLCH value directly, or inspect the secondary HEX, RGB, HSL, and OKLCH chips below.
  3. Click into Tailwind Scale Generator or Contrast Checker to validate accessibility on the converted shade.

Key Features

  • Bidirectional parsing supporting CSS Color Level 4 syntax cleanly
  • Hex decodes from gamma sRGB to linear light, transforms via a 3x3 cone-response matrix into cube-root OKLab coordinates (L, a, b), then converts cartesian (a, b) into Chroma C and Hue angle H.
  • Instant clipboard feedback with live OKLCH and Display-P3 gamut safety
  • Zero server round-trips—every calculation executes immediately in browser memory

Linear sRGB -> OKLab -> Cylindrical OKLCH

Hex decodes from gamma sRGB to linear light, transforms via a 3x3 cone-response matrix into cube-root OKLab coordinates (L, a, b), then converts cartesian (a, b) into Chroma C and Hue angle H.

Reference Snippet (CSS Color 4)

.button-primary {
  background: oklch(0.585 0.233 277.1);
}

Frequently Asked Questions

More Color Tools

View all tools →