Convert between HEX, RGB, HSL, and OKLCH with a live preview.
Last updated
Presets
PreviewValid color
Aa
ValuesClick any value to copy
HEX#B18CFF
RGBrgb(177, 140, 255)
HSLhsl(259, 100%, 77%)
OKLCHoklch(72.2% 0.165 296.9)
Contrast (WCAG)
2.60:1
8.06:1
Tints & shades
What is a color converter?
A color converter takes a color in any common format — HEX, RGB, HSL, OKLCH — and shows you every other format that represents the same color. It's the everyday tool for designers and developers when matching brand colors, debugging CSS variables, comparing dark- and light-mode palettes, or checking accessibility contrast.
CSS supports several color models, and each one has strengths. HEX and RGB describe colors in terms of red, green, and blue light. HSL is more intuitive (hue, saturation, lightness). OKLCH is a perceptual model where equal numerical changes look like equal perceptual changes — which makes it especially useful for generating tints, shades, and accessible palettes.
Accessibility comes from contrast, not just color. WCAG defines a contrast ratio between text and background — at least 4.5:1 for normal body text, 3:1 for large headings. A good color tool reports both numbers next to your color so you don't ship inaccessible UI by accident.
What you'll learn while converting colors
HEX is just a shorthand for RGB — #ff8800 is the same as rgb(255, 136, 0).
HSL separates *hue* (which color), *saturation* (how vivid), and *lightness* (how bright). Adjusting one without the others is much more intuitive than tweaking R/G/B.
OKLCH is perceptually uniform: bumping L by 10% in OKLCH looks like roughly the same lightness change for any hue. HSL doesn't behave that way.
How to convert and check colors step by step
1
Enter a color
Paste any HEX, RGB, HSL, or OKLCH value, or pick a color from the eyedropper / native picker.
2
Read every format at once
The converter shows the same color expressed in every supported format. Click any value to copy it to your clipboard.
3
Tweak with HSL or OKLCH sliders
Drag the lightness slider for tints (lighter) and shades (darker). Use OKLCH lightness for visually consistent steps.
4
Check contrast against text colors
The contrast panel shows the WCAG ratio against both white and black. Aim for ≥ 4.5 for body text and ≥ 3 for large headings.
5
Copy the value into your CSS
Use the format that matches your codebase — HEX for design tokens, OKLCH for modern palettes, HSL when you want to tweak with calc().
CSS color formats quick reference
The five formats you'll meet day-to-day, with examples for the same color. Full color-syntax reference on MDN's <color> page.
Holding hue (268) and chroma fixed and stepping lightness produces a consistent palette where every step *looks* like the same delta — which HSL doesn't guarantee.
/ 0.5 is the modern CSS way to add alpha. The HEX form appends a two-digit alpha byte (80 ≈ 50%).
Common color conversion mistakes
Comparing HSL lightness across hues. hsl(60 100% 50%) (yellow) and hsl(240 100% 50%) (blue) have the same L but very different perceived brightness — use OKLCH for visual comparisons.
Forgetting that 3-digit HEX (#abc) is shorthand for the 6-digit form (#aabbcc).
Using rgba(...) instead of the modern rgb(... / alpha) syntax — both work, but the slash form is the current spec and easier to read in tooling.
Color Converter FAQ
How do I convert HEX to RGB?
Split the HEX value into pairs (#RR, GG, BB) and convert each pair from hexadecimal to decimal. Or paste the value into a color converter and read the RGB result instantly.
What is the difference between HSL and OKLCH?
HSL is convenient and widely supported but not perceptually uniform — equal L doesn't always look equally bright. OKLCH is perceptually uniform, so it's better for generating consistent tints, shades, and accessible palettes.
What does OKLCH stand for?
OKLCH stands for Oklab Lightness, Chroma, Hue. It's based on the Oklab color space, designed to be perceptually uniform — small numerical changes look like small visual changes.
How do I check color contrast for accessibility?
Compute the WCAG contrast ratio between text and background. WCAG AA requires at least 4.5:1 for normal text and 3:1 for large text (18pt+ or 14pt bold). A color converter that reports contrast saves you the math.
Should I use HEX, RGB, HSL, or OKLCH in my CSS?
Use whichever your team is comfortable with. HEX is everywhere; OKLCH is the modern choice for design systems; HSL is great when you want to tweak hue or lightness with calculations. Browser support is excellent for all four.