Color formats define how colors are represented in digital systems. The five most common formats are HEX, RGB, HSL, HSV (also called HSB), and CMYK. Each serves different purposes: RGB and HEX dominate web development, HSL and HSV help designers adjust colors intuitively, and CMYK is essential for print.
This guide explains how each format works, provides conversion formulas with examples, and helps you choose the right format for your project.
| Format | Best For | Example |
|---|---|---|
| HEX | Web development, CSS | #FF5733 |
| RGB | Screen displays, CSS | rgb(255, 87, 51) |
| HSL | Adjusting brightness/saturation | hsl(14, 100%, 60%) |
| HSV/HSB | Design software (Photoshop, Figma) | hsv(14°, 80%, 100%) |
| CMYK | Print design | cmyk(0%, 66%, 80%, 0%) |
HEX (hexadecimal) is a six-character code that represents colors using base-16 notation. The format is #RRGGBB, where each pair represents red, green, and blue intensity from 00 to FF (0 to 255 in decimal).
Each pair of characters encodes one color channel:
The characters 0-9 and A-F represent values 0-15. Two characters together give 16 × 16 = 256 possible values per channel.
| Color | HEX Code | Breakdown |
|---|---|---|
| Pure red | #FF0000 |
Red=255, Green=0, Blue=0 |
| Pure green | #00FF00 |
Red=0, Green=255, Blue=0 |
| Pure blue | #0000FF |
Red=0, Green=0, Blue=255 |
| White | #FFFFFF |
All channels at maximum |
| Black | #000000 |
All channels at zero |
| Orange | #FF5733 |
Red=255, Green=87, Blue=51 |
When each pair has identical digits, you can use three-character shorthand:
#FF0000 → #F00#00FF00 → #0F0#336699 → #369To convert a HEX pair to decimal, multiply the first digit by 16 and add the second:
FF = (15 × 16) + 15 = 25533 = (3 × 16) + 3 = 51A0 = (10 × 16) + 0 = 160RGB (Red, Green, Blue) is an additive color model where colors are created by combining light. Each channel ranges from 0 to 255, giving 16.7 million possible colors (256³).
RGB is called "additive" because adding colors together creates lighter colors:
This matches how screens work: they emit red, green, and blue light that combines in your eyes.
/* Standard RGB */
color: rgb(255, 87, 51);
/* RGB with alpha (transparency) */
color: rgba(255, 87, 51, 0.5);
/* Modern CSS (alpha as percentage) */
color: rgb(255 87 51 / 50%);
To convert HEX to RGB, convert each pair from base-16 to base-10:
Example: #FF5733 to RGB
rgb(255, 87, 51)To convert RGB to HEX, convert each decimal value to two-digit hexadecimal:
Example: rgb(255, 87, 51) to HEX
#FF5733HSL (Hue, Saturation, Lightness) represents colors in a way that matches human perception. Instead of mixing primary colors, you specify the color type, its intensity, and brightness.
Hue (0-360°): The color's position on the color wheel
Saturation (0-100%): Color intensity
Lightness (0-100%): Brightness level
HSL makes color adjustments intuitive:
In RGB, these adjustments require changing multiple values in non-obvious ways.
/* Standard HSL */
color: hsl(14, 100%, 60%);
/* HSL with alpha */
color: hsla(14, 100%, 60%, 0.5);
/* Modern CSS */
color: hsl(14 100% 60% / 50%);
The conversion formula:
Example: rgb(255, 87, 51) to HSL
hsl(14, 100%, 60%)HSV (Hue, Saturation, Value) is similar to HSL but measures brightness differently. HSV is also called HSB (Hue, Saturation, Brightness). It's the default color model in Photoshop, Figma, and most design software.
The main difference is how they handle brightness:
HSL Lightness:
HSV Value/Brightness:
This means:
hsl(0, 100%, 50%) = Pure redhsv(0°, 100%, 100%) = Pure redhsl(0, 100%, 100%) = Whitehsv(0°, 0%, 100%) = WhiteCMYK (Cyan, Magenta, Yellow, Key/Black) is a subtractive color model used for printing. Unlike RGB which adds light, CMYK works by subtracting light—inks absorb certain wavelengths and reflect others.
On a white page:
RGB screens emit light; CMYK printers absorb it. This fundamental difference means:
Always convert to CMYK before sending designs to print, and expect some color shift.
The formula (simplified, assumes RGB values are 0-1):
K = 1 - max(R, G, B)
C = (1 - R - K) / (1 - K)
M = (1 - G - K) / (1 - K)
Y = (1 - B - K) / (1 - K)
Example: rgb(255, 87, 51) to CMYK
cmyk(0%, 66%, 80%, 0%)Here are some frequently needed color conversions:
| Color Name | HEX | RGB | HSL |
|---|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| Black | #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| Red | #FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| Green | #00FF00 | rgb(0, 255, 0) | hsl(120, 100%, 50%) |
| Blue | #0000FF | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
| Yellow | #FFFF00 | rgb(255, 255, 0) | hsl(60, 100%, 50%) |
| Cyan | #00FFFF | rgb(0, 255, 255) | hsl(180, 100%, 50%) |
| Magenta | #FF00FF | rgb(255, 0, 255) | hsl(300, 100%, 50%) |
| Brand | Approximate HEX | RGB |
|---|---|---|
| Facebook Blue | #1877F2 | rgb(24, 119, 242) |
| YouTube Red | #FF0000 | rgb(255, 0, 0) |
| Twitter/X Black | #000000 | rgb(0, 0, 0) |
| LinkedIn Blue | #0A66C2 | rgb(10, 102, 194) |
| Spotify Green | #1DB954 | rgb(29, 185, 84) |
| Aspect | HEX | RGB | HSL | HSV | CMYK |
|---|---|---|---|---|---|
| Primary use | Web | Web/Screen | Web/Design | Design software | |
| Intuitive adjustments | No | No | Yes | Somewhat | No |
| CSS support | Yes | Yes | Yes | No | No |
| Total colors | 16.7M | 16.7M | 16.7M | 16.7M | Varies |
| Transparency | #RRGGBBAA | rgba() | hsla() | No | No |
Use our Color Converter to instantly convert between all formats. Enter any color value and get HEX, RGB, HSL, HSV, and CMYK outputs with one click copy.
Color contrast matters for readability. The WCAG 2.1 guidelines require:
Use luminance (calculated from RGB) to check contrast:
Luminance = 0.299 × R + 0.587 × G + 0.114 × B
HEX and RGB represent the same colors differently. HEX uses hexadecimal notation (#FF5733), while RGB uses decimal notation (rgb(255, 87, 51)). They're interchangeable for web development—choose based on preference or code style guidelines.
Screens use RGB (additive light), while printers use CMYK (subtractive ink). The color gamuts don't fully overlap, so some screen colors can't be printed exactly. Always convert to CMYK and do a test print for color-critical work.
HEX and RGB are equally well-supported. Use HSL when you need to programmatically adjust brightness or saturation, as it maps more intuitively to human perception. Modern CSS supports all three.
Convert each pair of HEX digits to decimal. For example, #FF5733: FF = 255, 57 = 87, 33 = 51, giving rgb(255, 87, 51). Multiply the first digit by 16 and add the second.
The alpha channel controls transparency. A value of 1 (or 100% or FF) is fully opaque; 0 is fully transparent. Use rgba(), hsla(), or 8-digit HEX (#RRGGBBAA) to specify alpha.
HSL separates color (hue) from intensity (saturation) and brightness (lightness). To darken a color, just decrease lightness. In RGB, you'd need to decrease all three channels proportionally—less intuitive.
Both use hue and saturation, but measure brightness differently. HSL's lightness goes from black (0%) through pure color (50%) to white (100%). HSV's value goes from black (0%) to the brightest version of that color (100%), not white.
No. Browsers don't support CMYK. Convert CMYK values to RGB or HEX for web use. CMYK is only for print design workflows.
A color gamut is the range of colors a device can display or produce. RGB monitors have one gamut, CMYK printers have another. Colors outside a device's gamut can't be accurately reproduced on that device.
HEX can represent 16,777,216 colors (256 × 256 × 256). This is the same as RGB, since HEX is just a different notation for the same values.
Web-safe colors were a palette of 216 colors that displayed consistently on old 8-bit monitors. They're no longer relevant—modern displays support millions of colors.
In HSL or HSV, add 180° to the hue. For example, the complement of hsl(60, 100%, 50%) (yellow) is hsl(240, 100%, 50%) (blue).
"Key" refers to the key plate in printing—the plate that adds detail and contrast. Using "K" also avoids confusion with "B" for blue in RGB.
Yes. Photoshop accepts HEX input in its color picker. However, Photoshop's native color model is HSB (same as HSV), so that's what you'll see in the interface.
Use HSL and increase the lightness value. For example, change hsl(200, 80%, 40%) to hsl(200, 80%, 60%) for a lighter shade. Alternatively, use CSS color-mix() or relative color syntax in modern browsers.