Color Picker & Converter

Pick a color, or type a HEX, RGB, HSL or CMYK value, and every other format updates as you type.

Nearest CSS namedarkolivegreen #556b2fClosest match, not exact

Tints and shades (click one to copy its HEX)

How to use

  1. Click the color swatch to open your system color picker, or type a value into any of the four fields.
  2. HEX accepts 3, 6 or 8 digits, with or without the #. RGB, HSL and CMYK accept plain numbers separated by commas or spaces.
  3. The other fields update as soon as your value is valid. A red border means the value can't be read yet.
  4. Press Copy next to a format to copy it, ready to paste into CSS or a design app.
  5. Below the fields, pick a lighter or darker step from the tints and shades strip to copy it, or press Copy link to send someone the page with your color already loaded.

How it works

Every format here describes a color in the sRGB color space, the standard space for web pages. The tool turns whatever you type into red, green and blue values from 0 to 255, then writes those values out in the other formats.

HEX and RGB

A HEX code is the three RGB numbers written in base 16. Each pair of digits is one channel, from 00 (0) to ff (255). An optional fourth pair is the alpha (opacity).

RGB to HSL

HSL describes the same color as hue, saturation and lightness. With each channel divided by 255 so it runs from 0 to 1:

max = largest channel, min = smallest channel L = (max + min) / 2 S = (max − min) / (1 − |2L − 1|) (0 if max = min) H = 60° × position of the largest channel on the color wheel

Going back from HSL to RGB uses the algorithm published in CSS Color Module Level 4.

RGB to CMYK

K = 1 − max(R, G, B) C = (1 − R − K) / (1 − K) M = (1 − G − K) / (1 − K) Y = (1 − B − K) / (1 − K)

This is the standard device-independent formula. It ignores ink and paper, which is why the result is only a guide for print.

Nearest CSS color name

CSS has 148 named colors, from aliceblue to yellowgreen. To find the closest one, the tool converts your color and every named color to OKLab, a color space built so that equal distances look like roughly equal differences, and picks the name with the smallest straight-line distance. Measuring in RGB instead would often pick names that look further away, because RGB distance doesn't follow how the eye sees.

Tints and shades

The strip keeps your hue and saturation and moves HSL lightness in six even steps toward white (tints) and six toward black (shades), showing five of each with your color in the middle. Use it for hover states, borders and backgrounds that stay in the same family.

Worked example

Start with #e2553f.

RGB: e2 = 226, 55 = 85, 3f = 63, so rgb(226, 85, 63).

HSL: max = 226/255 = 0.89, min = 63/255 = 0.25. Lightness = (0.89 + 0.25) / 2 = 56.7%. Saturation = 73.8%. Red is the largest channel, so the hue sits near 0°: 8.1°. Rounded: hsl(8, 74%, 57%).

CMYK: K = 1 − 0.89 = 11.4%, giving cmyk(0%, 62%, 72%, 11%).

Nearest name: the closest CSS named color is indianred (#cd5c5c), at an OKLab distance of 0.048, so it is close but not exact. By contrast, #ff6347 returns tomato with a distance of 0.000: an exact match.

Tints and shades: the lightest tint is #fae3df and the darkest shade is #2a0b06.

Limits

  • CMYK is an approximation. It uses the simple formula with no color profile, so it won't match what a printer produces. For print work, convert in your design software with your printer's ICC profile.
  • All values are in the sRGB color space, the default for the web. Wide-gamut colors (Display P3, oklch()) are outside its range and aren't converted here.
  • HSL and CMYK are rounded to whole numbers, so converting back can shift a HEX value by one step in rare cases.
  • Transparency: an 8-digit HEX keeps its alpha in the HEX field, but the RGB, HSL and CMYK fields show the solid color only.
  • The swatch picker looks different in each browser and operating system; some show only a basic palette.
  • The nearest CSS name is the closest of the 148 named colors by OKLab distance. Most colors have no exact name, so the suggestion can look noticeably different; check the small swatch beside it before you use it.

FAQ

What is the difference between HEX and RGB?

They describe the same color. RGB lists the red, green and blue amounts as numbers from 0 to 255; HEX writes the same three numbers in base 16, two digits each. #e2553f is red 226 (e2), green 85 (55), blue 63 (3f).

What does a 3-digit HEX code mean?

It is shorthand where each digit is doubled: #fa0 is the same as #ffaa00. Only colors whose pairs repeat can be written this way.

Why does the tool copy rgb() with commas?

Both rgb(226, 85, 63) and the newer rgb(226 85 63) are valid CSS. The comma form works in every browser and in older tools and design apps, so it is the safer one to paste.

Is HSL better than RGB?

Neither is better; HSL is easier to adjust by hand. Hue is the position on the color wheel, saturation is how vivid the color is, and lightness runs from black to white, so making a color lighter only means raising one number.

Why doesn't my printed color match the CMYK value?

Real print color depends on the printer, ink and paper, which a color profile describes. This tool uses the plain formula without a profile, so treat the CMYK numbers as a starting point, not a print specification.

Does my color have a CSS name?

Only if it matches one of the 148 named colors exactly, in which case the tool says "exact match". Otherwise it shows the closest name, which you can use as a rough label in notes or class names, but paste the HEX value when the exact color matters.