Color Converter
Paste any color and get every format instantly — HEX, HEXA, RGB, RGBA, HSL, HWB, HSV, CMYK, OKLCH, OKLab, LAB, LCH, CSS, CSS variables, Tailwind and Display-P3.
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.
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
| Format | Model | Typical use |
|---|---|---|
HEX | sRGB byte triplet | CSS, design tools, documentation |
RGB | sRGB additive | Screens, canvas, WebGL |
HSL | sRGB as hue/saturation/lightness | Adjusting themes by hand |
HWB | Hue + whiteness/blackness | Mixing white/black into a hue |
CMYK | Subtractive (print) | Print production reference |
LAB / LCH | CIE perceptual | Color science, print matching |
OKLab / OKLCH | Perceptual (2020) | Modern UI palettes, accessible scales |
Display-P3 | Wide-gamut RGB | Screens 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.