Cadmeo

Color Converter

Three or six digits, with or without the #.

Formats
HEX: #0c6249
RGB: rgb(12, 98, 73)
HSL: hsl(163, 78%, 22%)
CMYK: cmyk(88%, 0%, 26%, 62%)

The color converter takes a hex value and shows it as RGB, HSL and CMYK simultaneously. The CMYK figure needs a caveat that most converters omit: without a colour profile, hex to CMYK is an arithmetic approximation, not a printable colour specification.

How it works

  • HEX and RGB are the same thing in different notation, two hex digits per channel, each 0 to 255.
  • HSL is a cylindrical remapping of RGB: hue in degrees, saturation and lightness as percentages. Converting between them is lossless.
  • CMYK here uses the naive formula: K is 1 minus the largest channel, and the other three are derived from it. It is reversible but it is not colour management.

K = 1 - max(R, G, B) C = (1 - R - K) / (1 - K)

R, G, B
each channel scaled to 0-1
K
the black channel, which absorbs whatever all three channels share

Examples

A brand green in four notations

Hex

#0c6249

Result

rgb(12, 98, 73) · hsl(165, 78%, 22%) · cmyk(88%, 0%, 26%, 62%)

The RGB and HSL figures describe exactly the same colour. The CMYK figure is a calculation, and a printer would produce something noticeably different from it.

Shorthand hex

Hex

#0c6

Result

Expands to #00cc66: each digit is doubled, not padded with zeros

Three-digit hex repeats each digit, so #0c6 is #00cc66 rather than #0c6000. Getting this wrong produces a completely different colour.

Frequently asked questions

Is the CMYK conversion accurate for printing?

No, and no converter without a colour profile can be. Real CMYK depends on the ink set, the paper and the press, which is what an ICC profile encodes. The arithmetic conversion here is a useful approximation for on-screen work and a poor basis for a print order, for that, convert in software with the printer’s profile loaded.

How does three-digit hex expand?

Each digit doubles: #0c6 becomes #00cc66. It does not pad with zeros. This catches people out because #0c6000 is a plausible-looking but completely different colour.

Is converting between HEX, RGB and HSL lossless?

Between HEX and RGB, yes. They are two notations for the same numbers. HSL round-trips cleanly for practical purposes, though rounding the percentages to whole numbers for display can shift the final hex by one on a channel.

Why does the tool take hex rather than letting me type any format?

Because one canonical input keeps the four outputs unambiguous. Accepting all four as input means deciding what to do when someone edits the CMYK figure, which cannot round-trip exactly, so the tool would have to either fight the user or silently change their colour.