Skip to content

Color Converter

Paste HEX, RGB, HSL, HSV/HSB or CMYK. Short HEX such as #F53 works too.

HEX code —
RGB
—
HSL
—

Paste a color code in any of five notations and the converter writes it in the other four. rgb(255, 87, 51) becomes #FF5733, hsl(11, 100%, 60%), hsv(11, 80%, 100%) and plain cmyk(0%, 66%, 80%, 0%). The steps show each base-16 pair and the max and min channels used for hue.

About this tool

A brand color rarely arrives in the notation you need: a style guide gives #1A73E8, a CSS file uses hsl(), Photoshop shows HSB, and a print brief asks for CMYK. This converter reads whichever code you paste, detects the notation from its prefix, and prints the same color in HEX, RGB, HSL, HSV and CMYK, with the arithmetic behind each figure. A short list of hue-rotated matches comes with it, each HEX ready to copy. The CMYK line is the naive device-independent split (K = 1 − brightest channel); it ignores ink, paper and ICC profiles, so a printer working from a FOGRA or GRACoL profile will quote different percentages for the same swatch.

How to use it

  1. Paste a code

    Type #663399, #F53, rgb(102, 51, 153), hsl(270, 50%, 40%), hsv(…) or cmyk(…); the prefix tells the converter which notation it is.

  2. Read the other notations

    HEX is the headline, RGB and HSL sit under it, and the steps list HSV and CMYK with the working.

  3. Optionally pick matching colours

    Choose complementary, analogous, triadic, split complementary or square to list hue-shifted partners with a copy button on each HEX.

Examples

Purple #663399 and its complement

Colour code
#663399
Matching colours
Complementary

Result HEX code: #663399
RGB: rgb(102, 51, 153)
HSL: hsl(270, 50%, 40%)

  1. RGB 102, 51, 153 → HEX: each channel in base 16 = #663399
  2. HSL: max 153, min 51 → lightness 40%, saturation 50%, hue 270°
  3. HSV / HSB: value = max ÷ 255 = 60%, saturation = (max − min) ÷ max = 67% → hsv(270, 67%, 60%)
  4. CMYK (plain, no print profile): K = 1 − max ÷ 255 = 40% → cmyk(33%, 67%, 0%, 40%)
  5. Harmony (complementary): rotate the hue of 270° around the wheel, keep saturation and lightness

The CSS named colour rebeccapurple sits at 270° on the wheel; its complement is the olive green at 90°.

An orange typed as RGB, triadic scheme

Colour code
rgb(255, 87, 51)
Matching colours
Triadic

Result HEX code: #FF5733
RGB: rgb(255, 87, 51)
HSL: hsl(11, 100%, 60%)

  1. RGB 255, 87, 51 → HEX: each channel in base 16 = #FF5733
  2. HSL: max 255, min 51 → lightness 60%, saturation 100%, hue 11°
  3. HSV / HSB: value = max ÷ 255 = 100%, saturation = (max − min) ÷ max = 80% → hsv(11, 80%, 100%)
  4. CMYK (plain, no print profile): K = 1 − max ÷ 255 = 0% → cmyk(0%, 66%, 80%, 0%)
  5. Harmony (triadic): rotate the hue of 11° around the wheel, keep saturation and lightness

The RGB triple becomes #FF5733, and the triadic scheme adds two colours 120° and 240° further round the wheel.

CSS green from HSL to CMYK

Colour code
hsl(120, 100%, 25%)
Matching colours
Analogous

Result HEX code: #008000
RGB: rgb(0, 128, 0)
HSL: hsl(120, 100%, 25%)

  1. RGB 0, 128, 0 → HEX: each channel in base 16 = #008000
  2. HSL: max 128, min 0 → lightness 25%, saturation 100%, hue 120°
  3. HSV / HSB: value = max ÷ 255 = 50%, saturation = (max − min) ÷ max = 100% → hsv(120, 100%, 50%)
  4. CMYK (plain, no print profile): K = 1 − max ÷ 255 = 50% → cmyk(100%, 0%, 100%, 50%)
  5. Harmony (analogous): rotate the hue of 120° around the wheel, keep saturation and lightness

hsl(120, 100%, 25%) is the CSS keyword green; on a plain conversion it needs full cyan and yellow with half black.

How it is calculated

L = (max + min) ÷ 2; S = (max − min) ÷ (1 − |2L − 1|); K = 1 − max; partner hue = base hue + 30°, 90°, 120°, 150°, 180°, 210° or 270°

max, min
largest and smallest of the red, green and blue channels, scaled 0 to 1
K
the black share in plain CMYK; C, M, Y are then (1 − channel − K) ÷ (1 − K)

HEX writes the red, green and blue bytes in base 16, two digits each. HSL and HSV follow the CSS Color Module Level 4 algorithm: hue is 60° times the position of the strongest channel relative to the others, lightness is the midpoint of max and min, and value is simply max. Going back from HSL or HSV to RGB reverses those steps, and CMYK to RGB is R = 255 × (1 − C) × (1 − K). Matching colours keep saturation and lightness and only add an angle to the hue.

Sources

Use from code or an AI agent Free API · MCP

The same calculation is a free JSON API. No key needed. The answer is in result.stats.primary.

curl -X POST https://api.tools-directory.workers.dev/v1/tools/color-converter \
  -H 'Content-Type: application/json' \
  -d '{"inputs":{"color":"#663399","harmony":"complementary"}}'

When not to use it

  • Do not hand the CMYK percentages to a press as final; ask for a profile-based conversion.
  • It does not match codes to Pantone, PMS or RAL books; those are licensed swatch lists, not formulas.
  • It reads typed codes only and cannot sample a color from an image or PDF.

Common mistakes

  • Confusing HSL with HSV: hsl(0, 100%, 50%) and hsv(0, 100%, 100%) are the same red.
  • Dropping a digit, so #08000 is rejected instead of read as #008000.
  • Typing RGB channels as percentages; each channel here runs 0 to 255.

Frequently asked questions

What is the formula to convert RGB to hex?

Write each channel, 0 to 255, as a two-digit base-16 number and join them after a #. For rgb(255, 87, 51): 255 ÷ 16 = 15 remainder 15, so FF; 87 = 5 × 16 + 7, so 57; 51 = 3 × 16 + 3, so 33. The result is #FF5733.

What is the HSL to RGB formula?

Compute chroma C = (1 − |2L − 1|) × S, then X = C × (1 − |(H ÷ 60) mod 2 − 1|) and m = L − C ÷ 2. Pick the (C, X, 0) order for the hue's 60° sector, add m to each, and multiply by 255. hsl(120, 100%, 25%) gives C = 0.5, m = 0, so rgb(0, 128, 0).

How do you convert hex to HSL by hand?

First turn the hex pairs into RGB and divide by 255. Lightness is (max + min) ÷ 2, saturation is (max − min) ÷ (1 − |2L − 1|), and hue depends on which channel is largest. #663399 gives max 0.6 (blue), min 0.2, so L = 40%, S = 50% and hue 270°.

What is the CMYK to RGB formula?

Each channel is 255 × (1 − ink) × (1 − K), with inks as fractions. cmyk(0, 66, 80, 0) gives R = 255, G = 255 × 0.34 = 87 and B = 255 × 0.2 = 51, so rgb(255, 87, 51). This is the naive formula; profile-managed software such as Illustrator or InDesign can return slightly different values.

How do I convert CMYK to a hex code?

Convert CMYK to RGB first with 255 × (1 − ink) × (1 − K), then write each channel in base 16. cmyk(100%, 0%, 100%, 50%) becomes rgb(0, 128, 0) and therefore #008000. Paste the cmyk() code and the converter does both steps and shows them.

How do I convert hex to HSV?

Read the hex as RGB fractions. Value is the largest channel, saturation is (max − min) ÷ max, and hue uses the same rule as HSL. #FF5733 has max 1 and min 0.2, so V = 100%, S = 80% and hue about 11°: hsv(11, 80%, 100%). Photoshop calls this HSB.

Can I convert CMYK to Pantone with a formula?

No. Pantone (PMS) colors are a licensed set of physical ink swatches, so there is no equation from CMYK to a Pantone number; matching needs Pantone's own guides or software. This converter covers the five open notations: HEX, RGB, HSL, HSV and CMYK.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, December 4). Color Converter. Tools Directory. Retrieved December 4, 2026, from https://directory.milunir.com/color-tools/color-converters/color-converter/

MLA

Tools Directory Editorial Team. “Color Converter.” Tools Directory, 4 Dec. 2026, https://directory.milunir.com/color-tools/color-converters/color-converter/. Accessed 4 Dec. 2026.

Chicago

Tools Directory Editorial Team. “Color Converter.” Tools Directory. Last modified December 4, 2026. Accessed December 4, 2026. https://directory.milunir.com/color-tools/color-converters/color-converter/.

Link<a href="https://directory.milunir.com/color-tools/color-converters/color-converter/">Color Converter – Tools Directory</a>