Enter any color
HEX, RGB, HSL, HWB, OKLCH, CMYK or CSS named color
Accepts HEX, HEXA, RGB, RGBA, HSL, HSLA, HWB, HSV, CMYK, OKLab, OKLCH, LAB, LCH and CSS named colors.
Preview
HEX —
RGB —
HSL —
Nearest CSS name —
About the input formats

The converter understands every modern CSS color syntax. Numbers may be separated by commas, spaces or a slash for alpha (for example rgb(79 70 229 / 50%)). Named CSS colors like rebeccapurple are also supported.

HEX, HEXA, RGB, RGBA, HSL, HSLA
HWB, HSV/HSB, CMYK
OKLab, OKLCH, LAB, LCH
148 CSS named colors
All outputs
Click any value to copy

How to convert HEX to RGB

Paste a HEX value into the input above. The converter instantly outputs:

  • RGB — decimal channel values 0–255, ready for CSS and canvas
  • RGBA — same values with an alpha channel
  • HSL — hue, saturation, lightness
  • OKLCH — perceptually uniform lightness, chroma and hue

Every conversion runs on your device. No value is ever uploaded, and the converter works offline after your first visit.

The math behind HEX → RGB

A 6-digit HEX code is three bytes written in base 16. Each pair of characters represents one channel:

# 4f 46 e5
  │   │   └── blue  = 0xe5 = 229
  │   └────── green = 0x46 = 70
  └────────── red   = 0x4f = 79

So #4f46e5 is rgb(79, 70, 229). Three-digit shorthand (for example #abc) is expanded by duplicating each character — #aabbcc.

Understanding the color spaces

FormatModelTypical use
HEXsRGB byte tripletCSS, design tools, documentation
RGBsRGB additiveScreens, canvas, WebGL
HSLsRGB as hue/saturation/lightnessAdjusting themes by hand
HWBHue + whiteness/blacknessMixing white/black into a hue
CMYKSubtractive (print)Print production reference
LAB / LCHCIE perceptualColor science, print matching
OKLab / OKLCHPerceptual (2020)Modern UI palettes, accessible scales
Display-P3Wide-gamut RGBScreens that exceed sRGB

Frequently asked questions

Is the conversion accurate?

Yes. Conversions use the standard sRGB transfer functions, D65 white point, CIE LAB matrices, and Björn Ottosson’s OKLab formulas. Every value you see is mathematically derived — nothing is guessed from a lookup table.

Does the converter preserve alpha?

Yes. If your input includes an alpha channel (for example, an 8-digit HEX or an RGBA value), the converter keeps it and outputs HEXA, RGBA and modern CSS syntax with the alpha value preserved.

Can I convert a color to a CSS variable?

Yes. The output list includes a ready-to-paste CSS custom property such as --color: #4f46e5; alongside every other format.

Does the converter work offline?

Yes. Omni Color is a Progressive Web App. After your first visit the converter continues working without a network connection.

Related tools