Color Converter
Color Converter translates colors between HEX, RGB, HSL and CSS OKLCH with a live swatch preview and RGB sliders, locally in your browser.
About this tool
HEX channels normalize to 0–255 sRGB, convert to HSL via chroma/max-min math, and linearize sRGB through the LMS/Oklab matrix to compute perceptually uniform CSS oklch(L C H) coordinates. Translate Figma hex swatches into HSL or OKLCH design tokens.
How to use the colour converter
- Type a HEX colour such as #1d4ed8, or use the colour picker to choose one.
- Or change the red, green and blue sliders to build a colour value by value.
- Read the swatch and the CSS formats: HEX, RGB, HSL and OKLCH where shown.
- Copy the format you need for your code or design file.
Colour formats and when to use them
HEX writes each channel as two hexadecimal digits, from 00 to FF. RGB writes the same channels as numbers from 0 to 255. HSL describes a colour by hue, saturation and lightness, which is easier to adjust by eye. OKLCH is a newer perceptual format where equal steps look more even, which helps when you build a palette.
Supports three-digit and six-digit HEX. A three-digit value such as #1ad doubles each digit to become #11aadd.
A worked example
The default blue, #1d4ed8, converts to red 29, green 78 and blue 216 in RGB. Its brightness is low enough that white text on it reads clearly, which is why this value is used for many buttons on this site.
- Convert a brand colour from a design file's HEX value into RGB for a graphic tool.
- Turn a three-digit colour from an old stylesheet into its six-digit equivalent.
Who uses a colour converter
- Designers moving colours between design tools and code.
- Developers writing CSS with variables and different formats.
- Brand teams checking that a colour matches across print and screen.
- Students learning how colour is represented digitally.
- Anyone who needs a colour in a format a program understands.
Tips and common mistakes
- Colours on screen differ between devices. Use the values as a guide, and check them on the target screen.
- CMYK values for print are not the same as RGB. Convert with a print profile when the job matters.
- A HEX value without the leading hash, such as 1d4ed8, is still valid in many tools but not in every stylesheet.
- Check contrast after choosing a text and background pair, using the WCAG Contrast Checker.
- Your colours stay in your browser and are not stored.
Frequently asked questions
Aspect Ratio Calculator
Aspect Ratio Calculator simplifies ratios using the GCD, scales pixel dimensions proportionally and copies CSS aspect-ratio rules, in your browser.
Box Shadow Generator
Box Shadow Generator designs CSS shadows visually with X/Y offset, blur, spread, opacity and inset controls, locally in your browser.
WCAG Contrast Checker
WCAG Contrast Checker tests foreground and background color pairs against WCAG 2.1 AA and AAA ratios, with live preview cards in your browser.
No matching tools. Clear the filter to see all.