Color Model Reference
To convert HEX to RGB, split the code into three pairs and read each pair as a base-16 number: #1E90FF = rgb(30, 144, 255). From RGB the converter works out HSL, HSB (HSV) and CMYK with the standard formulas used by CSS and design apps. It also runs the other way: type values in any model and every other format updates.
All models represent the same colors differently. HEX and RGB are used in web and screen design. HSL and HSB are easier for designers to adjust intuitively. CMYK is for print.
| Model | Range | Used In |
|---|---|---|
| HEX | #000000: #FFFFFF | CSS, HTML, web design |
| RGB | 0 to 255 per channel | Screens, CSS, programming |
| HSL | H:0-360 S/L:0-100% | CSS, design systems |
| HSB/HSV | H:0-360 S/B:0-100% | Photoshop, Illustrator |
| CMYK | 0 to 100% per channel | Print, InDesign |
Common Colors in Every Model
Computed with this page's own conversion code. HSL, HSB and CMYK values are rounded to whole numbers, the way the converter shows them.
| Color | HEX | RGB | HSL | HSB / HSV | CMYK |
|---|---|---|---|---|---|
| Red | #FF0000 | 255, 0, 0 | 0°, 100%, 50% | 0°, 100%, 100% | 0, 100, 100, 0 |
| Orange | #FFA500 | 255, 165, 0 | 39°, 100%, 50% | 39°, 100%, 100% | 0, 35, 100, 0 |
| Yellow | #FFFF00 | 255, 255, 0 | 60°, 100%, 50% | 60°, 100%, 100% | 0, 0, 100, 0 |
| Green (CSS) | #008000 | 0, 128, 0 | 120°, 100%, 25% | 120°, 100%, 50% | 100, 0, 100, 50 |
| Lime | #00FF00 | 0, 255, 0 | 120°, 100%, 50% | 120°, 100%, 100% | 100, 0, 100, 0 |
| Cyan | #00FFFF | 0, 255, 255 | 180°, 100%, 50% | 180°, 100%, 100% | 100, 0, 0, 0 |
| Dodger blue | #1E90FF | 30, 144, 255 | 210°, 100%, 56% | 210°, 88%, 100% | 88, 44, 0, 0 |
| Blue | #0000FF | 0, 0, 255 | 240°, 100%, 50% | 240°, 100%, 100% | 100, 100, 0, 0 |
| Navy | #000080 | 0, 0, 128 | 240°, 100%, 25% | 240°, 100%, 50% | 100, 100, 0, 50 |
| Purple | #800080 | 128, 0, 128 | 300°, 100%, 25% | 300°, 100%, 50% | 0, 100, 0, 50 |
| Magenta | #FF00FF | 255, 0, 255 | 300°, 100%, 50% | 300°, 100%, 100% | 0, 100, 0, 0 |
| Gray | #808080 | 128, 128, 128 | 0°, 0%, 50% | 0°, 0%, 50% | 0, 0, 0, 50 |
| White | #FFFFFF | 255, 255, 255 | 0°, 0%, 100% | 0°, 0%, 100% | 0, 0, 0, 0 |
| Black | #000000 | 0, 0, 0 | 0°, 0%, 0% | 0°, 0%, 0% | 0, 0, 0, 100 |
The Formulas, Worked Through
Example color: #1E90FF.
- HEX to RGB. 1E = 1×16 + 14 = 30, 90 = 9×16 + 0 = 144, FF = 15×16 + 15 = 255. So rgb(30, 144, 255).
- Scale to 0 to 1. Divide by 255: R = 0.118, G = 0.565, B = 1. The largest value (max) is 1 and the smallest (min) is 0.118, so the spread is 0.882.
- HSL. Lightness = (max + min) ÷ 2 = 0.559, or 56%. Saturation = spread ÷ (1 − |2L − 1|) = 0.882 ÷ 0.882 = 100%. Blue is the largest channel, so hue = 60 × ((R − G) ÷ spread + 4) = 209.6, rounded to 210°.
- HSB / HSV. Brightness = max = 100%. Saturation = spread ÷ max = 88%. The hue is the same 210°.
- CMYK. K = 1 − max = 0. C = (1 − R − K) ÷ (1 − K) = 88%, M = 44%, Y = 0%.
The complementary color keeps saturation and lightness and turns the hue by 180°: 210° becomes 30°, which is #FF8D1E, a warm orange.
Why Round Trips Can Shift by One
RGB has 16,777,216 colors. HSL, HSB and CMYK shown as whole numbers have fewer distinct steps, so some precision is lost when you convert and convert back. We ran every RGB color through this page's code:
| Round trip (whole-number values) | Colors that come back exactly |
|---|---|
| RGB to HSL to RGB | 1,775,056 (10.6%) |
| RGB to HSB to RGB | 2,044,805 (12.2%) |
| RGB to CMYK to RGB | 2,136,545 (12.7%) |
The rest land on a neighbor, usually one or two steps away in a channel. #1E90FF, for example, becomes hsl(210, 100%, 56%) and returns as rgb(31, 143, 255). The difference is invisible, but if an exact brand color matters, keep the HEX or RGB value as the master and treat HSL or CMYK as derived.
Common Mistakes
- Mixing up HSL lightness and HSB brightness. Pure red is 50% lightness in HSL but 100% brightness in HSB.
- Treating this CMYK as a print proof. The formula is the simple device conversion. Printers use ICC color profiles, ink limits and paper type, so their numbers for the same color will differ.
- Expanding shorthand wrongly. #1AF means #11AAFF, not #1AF000.
- Reading alpha as a percentage. In #RRGGBBAA the alpha 80 is 128 out of 255, or 50.2% opacity, not 80%.