vasilenko.info

Color converter: HEX, RGB, HSL, OKLCH, LAB, and CMYK

/en/tool/color-converter/ works Runs in the browser

Paste a color in any format — HEX, rgb(), hsl(), hwb(), lab(), lch(), oklch(), color(display-p3 …), or an English name — and get eleven other formats at once, with each one copied in a separate click. You also get OKLCH sliders, sRGB, P3, and Rec2020 gamut, contrast against any background using WCAG and APCA, a ready-made shade scale from 50–950, and previews of how the color looks with three types of color blindness. Nothing is sent to the server.

promoTwenty years of notes on websitesHow we did it in 2008 and what still works today.Open

Color

The format is detected automatically by the hash sign, function name, or color name. The sliders adjust the same color shown in the field.

#3366CC · 3366CC · rgb(51 102 204) · hsl(220 60% 50%) · hwb(220 20% 20%) · lab(45 8 -55) · oklch(53.25% 0.1679 262.29) · color(display-p3 .2 .4 .8) · steelblue Couldn't parse the color. Example: #3366CC
OKLCH picker
The gray part of the track is saturation that isn't available in sRGB at this lightness and hue.
The checkerboard under the swatch is visible where the color has transparency.

HEX

Clicking a value copies it to the clipboard. The browser does the calculation: the color isn't sent anywhere — you can see this in the developer tools. After the requests load, there are no more requests.

Contrast

The color is evaluated as text against the selected background. A semitransparent color is first composited with the background — the result is what appears on screen.

Any of the same formats. Background opacity isn't considered: what's underneath it is unknown. Couldn't parse the background color. Example: #FFFFFF

Large text, 24 px bold

Normal text, 16 px. Under WCAG, large text is 18 pt or larger, which is 24 px, and bold text is 14 pt or larger, which is about 18.7 px.

Small caption, 13 px — it's always normal text; threshold 4.5.

Contrast against background

:1

AA, normal text — 4.5 or higher
AA, large text — 3 or higher
AAA, normal text — 7 or higher
AAA, large text — 4.5 or higher
Icons and form borders — 3 or higher
APCA Lc
Contrast against white
Contrast against black

WCAG 2 answers “pass or fail,” while APCA answers “how readable”: Lc 60 roughly corresponds to normal text, Lc 45 to large text, and Lc 90 to small text.

Shades from 50 to 950

Eleven steps from your color: the hue stays the same, while lightness follows the OKLCH scale. Clicking a step copies its HEX value to the clipboard.

Only Latin letters, numbers, and hyphens will remain. The name must start with a letter; otherwise, brand will be used.
brand.css Variables and an @theme block for Tailwind 4
tailwind.config.js For Tailwind 3

Here, the scale is an add-on to the color. If you need the scale itself—with each step explained, its contrast, and format selection—see the separate color scale generator. Color scale generator.

How color appears with color blindness

Recalculated using the Brettel–Viénot–Mollon model: this shows how the color appears to an eye missing one of the three types of cones.

If two swatches next to each other become identical, that means you cannot distinguish interface states using this color alone: you also need an icon, label, or different lightness.

promoCalculate ROI at the same timeCampaign payback based on spend and revenue.Open

How to use it

  1. Paste the color as is: #3366CC, 3366CC without the hash, rgb(51 102 204), rgba(51,102,204,.5), hsl(220 60% 50%), hwb(220 20% 20%), lab(45 8 -55), lch(45 56 278), oklch(53.25% 0.1679 262.29), color(display-p3 .2 .4 .8), or an English name such as steelblue.

  2. Click any value on the right—it will be copied to the clipboard in full, exactly as it is inserted into code. The “Copy all formats” button copies the entire list at once.

  3. Adjust the color with the OKLCH sliders: lightness, chroma, hue, and transparency. On the chroma track, gray marks the range that is outside sRGB at this lightness—moving farther is pointless if the color is intended for a standard display.

  4. The gamut line shows where the color fits: sRGB, P3 only, or Rec2020 only. If it is wider than sRGB, a fallback value is printed beside it—the same hue and lightness, but with chroma reduced to the sRGB limit.

  5. In the contrast section, enter your page's actual background instead of white. It also calculates APCA Lc, which is more accurate for dark themes and thin text than the WCAG ratio.

  6. The result link lives in the address bar: the color is added automatically, and the “Copy link” button copies the full address. The last twelve colors remain in a strip below the field—they are stored in the browser and go nowhere.

promoBrowser task listNo account required—everything is stored on your device.Open

The formula and what it includes

HEX ⇄ RGB ⇄ HSL ⇄ HWB ⇄ HSV — arithmetic. RGB → XYZ → LAB, LCH. RGB → LMS → OKLab → OKLCH

HSL and OKLCH answer different questions. In HSL, yellow and blue can both have 50% lightness, even though yellow looks noticeably lighter. In OKLCH, the same L means the same perceived lightness, which makes it useful for building color scales and for finding the nearest CSS name.

Example breakdown: #3366CC

The input data is the same as the default field values: you can calculate it mentally and confirm that the tool is telling the truth.

  1. Split it into pairs of digits: 33 = 51, 66 = 102, CC = 204. That gives rgb(51, 102, 204).

  2. The brightest channel is 204 and the darkest is 51. HSL lightness is their average: (204 + 51) ÷ 2 = 127.5, exactly half of 255.

  3. Saturation: the range is 204 − 51 = 153; divide by 255 to get 60%.

  4. The maximum is the blue channel, so the hue is calculated from 240°: 240 + 60 × (51 − 102) ÷ 153 = 240 − 20 = 220°.

  5. HWB uses the same extreme channels differently: the color contains 51 ÷ 255 = 20% white and 1 − 204 ÷ 255 = 20% black. The hue remains 220°.

HSL: hsl(220, 60%, 50%). HWB: hwb(220 20% 20%). The same color in OKLCH is oklch(53.25% 0.1679 262.29). The route there runs through XYZ and OKLab and cannot be calculated mentally, but 53% lightness there means the true perceptual midpoint—unlike 50% in HSL. The nearest CSS name is royalblue; the OKLab difference is noticeable: names are spaced far apart, so an exact match is uncommon.

Frequently asked questions

promoAll toolsForty-four tools, all running in your browser.Open

Related tools

5

WCAG contrast checker

Calculates the contrast of a color pair and shows whether it passes AA and AAA.

Open