ToolGlint

Color Converter

Convert colors between HEX, RGB, HSL and OKLCH, with a color picker and live preview. Free and runs in your browser.

Try:

Aa

White text3.68:1Large text only

Aa

Black text5.71:1AA

Lighter and darker (click one to convert it)

Runs in your browser. Nothing you enter is uploaded or stored.

How to use the Color Converter

  1. Type or paste a color into the box, in HEX, rgb(), hsl() or oklch() form.
  2. Or press the Pick swatch to choose a color with your browser’s color picker.
  3. Check the preview to see the color. A partly transparent one shows over a chequered background.
  4. Read the color in all four formats below the preview.
  5. Click any row to copy that value, ready to paste into CSS.
  6. Look under the preview to see whether white or black text is readable on the color, with its contrast ratio.
  7. Click one of the lighter and darker versions to carry on from that color.

Questions and answers

Which color formats can I enter?
HEX with three, four, six or eight digits, with or without the #; rgb() and rgba(); hsl() and hsla(); and oklch(). The functions are accepted in both the older comma form and the newer space form, and transparency can be given as a number or a percentage. Color names such as “red” are not read.
How do I convert HEX to RGB?
A six-digit HEX color is three pairs of hexadecimal digits for red, green and blue. Convert each pair to decimal: #3b82f6 is 3b, 82 and f6, which are 59, 130 and 246, so the color is rgb(59, 130, 246). The tool does this for you as you type.
What is the difference between RGB and HSL?
RGB describes a color by how much red, green and blue light it mixes, which is how screens work. HSL describes the same color by hue, saturation and lightness, which is closer to how people think: to make a color lighter or less vivid, you change one number.
What is OKLCH and why use it?
OKLCH describes a color by lightness, chroma and hue, like HSL, but it is built to match human vision. Two colors with the same OKLCH lightness look equally light, which is not true in HSL. That makes it good for building color scales and for keeping text contrast steady. All current browsers support it in CSS.
Why does it say my OKLCH color is outside sRGB?
OKLCH can describe colors more vivid than an ordinary sRGB screen can show. HEX, RGB and HSL cannot hold those colors, so the tool shows the nearest one that fits. The original still works in CSS on screens with a wider color range.
How do I add transparency to a color?
Add an alpha value. In HEX, add two more digits, so #3b82f680 is half transparent. In the functions, add a fourth number from 0 to 1 or a percentage, such as rgb(59 130 246 / 50%). The tool shows the transparent color in every format.

Related tools