Skip to main content
Tools

Color Converter

Convert colors between HEX, RGB, HSL, HWB, OKLCH and OKLab, with a color picker and WCAG contrast check.

Supports HEX, rgb(), hsl(), hwb(), oklch(), oklab() and CSS color names.

Formats

#3366cc

Input format: HEX

  • HEX#3366cc
  • RGBrgb(51 102 204)
  • HSLhsl(220 60% 50%)
  • HWBhwb(220 20% 20%)
  • OKLCHoklch(53.25% 0.1679 262.29)
  • OKLaboklab(53.25% -0.0225 -0.1663)

Contrast (WCAG 2)

On white

Aa text

5.36:1

✓ Passes AA

On black

Aa text

3.91:1

✗ AA for large text only

How to use

  1. Type any CSS color into “Color”, such as #3366cc, rgb(51 102 204), hsl(220 60% 50%), oklch(52% 0.16 262) or tomato, or pick one with the color picker.
  2. HEX, RGB, HSL, HWB, OKLCH and OKLab appear instantly as CSS values. Click “Copy” to paste one into your stylesheet.
  3. The “Contrast” section shows the WCAG contrast ratio against white and black, and whether it meets AA or AAA.
  4. Click “Example” to cycle through colors in different formats, including translucent and out-of-gamut ones.

FAQ

What is OKLCH and why use it?

OKLCH is a perceptual color space: L is lightness, C is chroma and H is hue. Changing lightness does not shift the hue, which makes it easier than HSL for building color scales and dark themes. All modern browsers support oklch() in CSS.

What does “outside the sRGB gamut” mean?

OKLCH and OKLab can describe colors more vivid than a typical (sRGB) screen can show. For those, the tool follows CSS Color 4: it lowers chroma while keeping lightness and hue to find the closest displayable color, then converts that to HEX, RGB and the rest.

How do I read the contrast ratio?

WCAG 2 requires at least 4.5:1 between normal text and its background for AA and 7:1 for AAA. Large text (18 pt, or 14 pt bold) needs only 3:1. Ratios are truncated, never rounded up, so a color that just misses is not shown as passing.

How is transparency handled?

Alpha is kept in every format: HEX becomes 8 digits (#rrggbbaa) and the other formats get “/ 0.5”. The color picker and the contrast check use the opaque color.

Why do values change slightly after a round trip?

HEX and RGB have only 256 steps per channel, so converting from a continuous space such as OKLCH rounds the result. The difference is too small to see.

Is my data uploaded?

No. All conversions happen in your browser, with no network connection needed.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.