Color Converter: HEX, RGB and Related Colour Models
Where Most People Start
Every Converter in This Family
Both directions between a hex colour code and its channel values. Each page shows the arithmetic for every channel and paints the colour beside the answer, so a mistyped digit is visible rather than plausible.
| From | To | Tool |
|---|---|---|
| HEX | RGB | HEX to RGB |
| RGB | HEX | RGB to HEX |
What can a colour converter convert?
Two notations for one colour, and both run in both directions. 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.
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.
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, what a hexadecimal number is worth in decimal.
What This Section Holds
What this section holds today, counted from the link graph rather than from memory.
| What | Value |
|---|---|
| Where the notation is defined | W3C CSS Color Module Level 4 |
| The colour space | sRGB |
| Tools linked here | 2 |
| Pages in the family | 3 |
Frequently Asked Questions
What about HSL, CMYK and other colour models?
Neither is built here yet. This section covers the hex form and the rgb() form, which both name a point in the same space. HSL and CMYK describe a colour differently and would need pages of their own.
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 #.