Skip to the content

Color Converter

HEX, RGB, HSL, HSV, CMYK and OKLCH converted both ways, with a picker.

HEX, rgb, hsl, oklch or a color name.

Hue
262°Alpha
100%
Name

bluevioletnearest CSS name, #8a2be2

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

One color, seven ways to write it

Every row above describes the same color. Which one you need depends on where the color is going.

NotationWhere it is used
HEXCSS and design tools, anywhere a color has to fit in one word
RGBThe same three numbers in decimal, handy for code that calculates
HSLAdjusting by eye: turn the hue, make it lighter or grayer
HSVThe pickers of design programs, where it is often called HSB
HWBA hue with white and black mixed in; valid CSS, seldom seen
CMYKA first estimate for print
OKLCHPalettes and gradients whose steps should look even

HEX and RGB are the same numbers

A HEX code holds the red, green and blue values, each from 0 to 255, as two hexadecimal digits. For #7c3aed:

  • red is 7c: 7 × 16 + 12 = 124
  • green is 3a: 3 × 16 + 10 = 58
  • blue is ed: 14 × 16 + 13 = 237

That makes it rgb(124, 58, 237). The short form doubles every digit, so #f80 means #ff8800. A fourth pair of digits is the alpha: 80 is 128, and 128 ÷ 255 is about 0.5, so #7c3aed80 is the same violet at half opacity.

Why the HSL values have a decimal

Many converters round HSL to whole numbers, and the result is a slightly different color: hsl(262, 83%, 58%) is #7c3bed, not #7c3aed. With one decimal, HSL, HSV and HWB lead back to the exact HEX code for all 16.7 million colors.

OKLCH

OKLCH has a lightness from 0 to 1, a chroma (how colorful; sRGB colors reach about 0.32) and a hue angle. Its lightness is built to match what the eye sees, which the lightness of HSL is not. Yellow, hsl(60, 100%, 50%), and blue, hsl(240, 100%, 50%), share an HSL lightness of 50%. Their OKLCH lightness is 0.97 and 0.45.

The values get four decimals for lightness and five for chroma, the fewest that lead back to the same HEX code. Browsers do this conversion with their own arithmetic, and Chrome ends up one step away in one channel for a few bright greens.

OKLCH can also describe colors that an sRGB screen cannot show. When you type one, the chroma is lowered until the color fits, lightness and hue are kept, and a note under the field says so. Chrome currently cuts off the channels instead: oklch(0.7 0.3 150) shows as #00cb00 there and comes out as #00be58 here.

CMYK is an estimate

The CMYK row uses the textbook formula: black is what the brightest channel lacks, K = 1 − max(R, G, B) ÷ 255, and the other three inks make up the difference. Real printing depends on the press, the ink and the paper, which is what a color profile describes. A design program with the printer's profile will give other percentages, and some screen colors, bright blues and greens among them, cannot be printed at all. Treat the numbers as a starting point, not as a specification for a printer.

Good to know

  • The name is the closest of the 148 named CSS colors, measured in OKLab. It is your exact color only where it says "exact match".
  • "Pick from screen" uses the browser's eyedropper, which Chrome and Edge have on desktop computers.
  • The address of this page ends in the current color, so a bookmark or a shared link opens with it.
See all 8