DailyDeskTools home

Color Converter: HEX, RGB, HSL and OKLCH

Convert colors between HEX, RGB, HSL, HSV and OKLCH, with a picker and contrast check.

  • Free forever
  • No signup
  • Runs on your device
Color ConverterRuns locally · nothing uploaded
Loading tool…

How to use the Color Converter

  1. 1Type any CSS color, such as #ff6600, rgb(255 102 0), hsl(24 100% 50%) or a name like tomato.
  2. 2Or click the swatch to pick a color.
  3. 3Copy the format you need.
  4. 4Check the contrast samples to see if the color works as text on white or black.

Color formats explained

  • HEX (#0f766e) is the most common format on the web: red, green and blue as two hexadecimal digits each.
  • RGB gives the same three channels as numbers from 0 to 255.
  • HSL describes hue (0–360°), saturation and lightness, which is easier for people to adjust.
  • HSV / HSB is used by many design apps' color pickers.
  • OKLCH is a modern CSS format based on how people perceive color. Changing lightness keeps the color looking consistent, which makes it ideal for building color palettes and themes.

Any CSS color works

The converter uses your browser's own color parser, so it accepts every format CSS does, including the 148 named colors and colors with transparency.

Contrast

The samples show the color as text on white and on black, with the WCAG contrast ratio. Body text needs at least 4.5:1 (AA), large text 3:1, and the stricter AAA level asks for 7:1.

Reference values

HEX RGB HSL
#FF0000 255, 0, 0 0, 100%, 50%
#0F766E 15, 118, 110 175, 77%, 26%
#3B82F6 59, 130, 246 217, 91%, 60%
#F59E0B 245, 158, 11 38, 92%, 50%
#8B5CF6 139, 92, 246 258, 90%, 66%
#111827 17, 24, 39 221, 39%, 11%

Doing it by hand

HEX is RGB written in base 16, two digits per channel. For #3B82F6: 3B is 59, 82 is 130 and F6 is 246. A three-digit code like #0f0 doubles each digit, so it means #00ff00.

Which format to use

HEX is the shortest to paste. RGB suits code that builds colors from numbers or adds an alpha channel. HSL is easiest to adjust by eye: keep the hue, raise or lower lightness. HSL lightness is not perceptual, though, so two colors at 50% can look very different in brightness, which is the reason designers move to OKLCH for generated scales.

After converting a brand color, check it against its background with the WCAG contrast checker, build a full scale in the color palette generator, or use it as a stop in the CSS gradient generator.

Frequently asked questions

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each pair from hexadecimal to a number. #0f766e becomes 15, 118, 110. The tool does this instantly.

What is OKLCH and should I use it?

OKLCH is a perceptual color format supported by all modern browsers. It is great for design systems because equal changes in lightness look equal to the eye.

Why do some conversions round slightly?

HSL and OKLCH values are rounded for readability, so converting back may differ by a unit or so in RGB.

What contrast ratio do I need?

WCAG asks for at least 4.5:1 for normal text and 3:1 for large text to reach level AA.

What does the 8-digit HEX code mean?

The last two digits are opacity. #3B82F680 is the color #3B82F6 at about 50% opacity, because hex 80 is 128 out of 255.

What is the difference between HSL and HSV?

Both use hue and saturation. HSL's third value is lightness, where 100% is always white. HSV (also called HSB) uses brightness, where 100% is the full-strength color.

Last updated · By the DailyDeskTools team

Built and written with AI assistance, then tested by hand by our team. How we make our tools