Color Converter: HEX, RGB and CMYK

Read as a hex colour code.

HEX #1A2B3C
RGB rgb(26, 43, 60)
CMYK cmyk(57%, 28%, 0%, 76%)
The CMYK line is the CSS Color 5 formula, not a print profile.

Every Converter in This Family

Every direction between a hex colour code, its channel values and CMYK ink percentages. Each page shows the arithmetic for every channel or ink and paints the colour beside the answer, so a mistyped value is visible rather than plausible.

Every Converter in This Family
FromToTool
HEX RGB HEX to RGB
RGB HEX RGB to HEX
RGB CMYK RGB to CMYK
HEX CMYK HEX to CMYK
CMYK RGB CMYK to RGB
CMYK HEX CMYK to HEX

What can a colour converter convert?

Three notations for one colour, each converting both ways. A hex colour code is what a stylesheet, a design file or a brand guide carries. The rgb() form is what a colour picker hands you and what most drawing tools show you while you work. CMYK is four ink percentages, the form printers often use, and its pages give the published formula result.

One thing is worth settling before you pick a page: a hex colour code and a hexadecimal number are not the same object, even though they share the word and the digits. The border section below says which page answers which question.

A hex code and an rgb() value both name a point in sRGB, the colour space CSS resolves these notations into.

The hex notation and the rgb() function are both defined by the W3C CSS Color Module Level 4.

A formula CMYK value is not a press-ready separation. Print work converts colour through an ICC profile made for one set of inks, paper and press, such as a FOGRA39 coated-paper profile, so a printer's or design app's CMYK for the same colour can differ.

Which Converter Do I Need?

A Colour Code, Not a Number

A hex colour code is three channel bytes behind a #, and the pages here read it that way. If you want the numeric value of a hex number rather than a colour, convert it from hex to decimal.

A Formula, Not a Press Profile

The CMYK pages apply one published formula, so every device gets the same answer from them. A press-ready value depends on the press, which is why the statement above sends print work through a profile and why each CMYK page repeats the point under its result.

Guides

What This Section Holds

What this section holds today, counted from the link graph rather than from memory.

What This Section Holds
WhatValue
Where the notation is defined W3C CSS Color Module Level 4
The colour space sRGB
Tools linked here 6
Pages in the family 7
Where the CMYK formula is defined W3C CSS Color Module Level 5

Frequently Asked Questions

What about HSL, CMYK and other colour models?

CMYK is built: four converters take it to and from RGB and hex codes with the CSS Color 5 formula, and each one says where that formula stops short of a print profile. HSL and RGBA have no pages here yet; the eight-digit hex form is where this section handles alpha.

Is a hex colour code the same as a hexadecimal number?

No, although they share the word and the digits. A hex colour code is three channel bytes behind a #, read one pair at a time. A hexadecimal number is one value in base 16, read as a whole, and it belongs to the number system pages.

Does a hex colour code need the # in front?

In a stylesheet, yes: the # is what marks the value as a colour rather than as anything else. The converters here read a code with the # or without it, and always write it back with the #.