Convert RGB color values to hexadecimal codes instantly. Preview colors, get detailed color information, and work with multiple color formats.
Each RGB component (0-255) is converted to a 2-digit hexadecimal value:
| Format | Syntax | Value | Action |
|---|---|---|---|
| Hexadecimal (Full) | #RRGGBB | #2C7DA0 | |
| Hexadecimal (Short) | #RGB | #2C7DA0 | |
| RGB | RGB(r, g, b) | RGB(44, 125, 160) | |
| RGBA | RGBA(r, g, b, a) | RGBA(44, 125, 160, 1) | |
| HSL | HSL(h, s%, l%) | HSL(198, 57%, 40%) | |
| HSLA | HSLA(h, s%, l%, a) | HSLA(198, 57%, 40%, 1) | |
| CSS rgb() | rgb(r, g, b) | rgb(44, 125, 160) | |
| CMYK | CMYK(c, m, y, k) | CMYK(73%, 22%, 0%, 37%) |
These are harmonizing colors that work well with your selected color in design projects.
RGB (Red, Green, Blue) and hexadecimal color codes are two fundamental ways to represent colors in digital design, web development, and computer graphics.
RGB Color Model:
The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. Each component ranges from 0 to 255.
RGB(Red, Green, Blue)
Where Red, Green, and Blue are integer values between 0 and 255 inclusive.
Hexadecimal Color Codes:
Hexadecimal colors are a compact representation of RGB values using base-16 notation. Each pair of hexadecimal digits represents one RGB component:
#RRGGBB
Where RR (red), GG (green), and BB (blue) are hexadecimal values ranging from 00 to FF (0 to 255 in decimal).
Decimal to Hexadecimal Conversion:
To convert a decimal value (0-255) to hexadecimal:
Example: Convert 125 to hexadecimal:
125 ÷ 16 = 7 remainder 13
7 = 7 in hex, 13 = D in hex
Result: 7D
Alternative method: Decimal value → toString(16) → pad with leading zero if needed
3-digit Hex Codes: When each pair of hexadecimal digits consists of the same digit (e.g., #FFCC99), it can be shortened to 3 digits (#FC9). This is a CSS shorthand notation that reduces file size and improves readability.
When to Use Shorthand: Shorthand notation is only possible when each color component's hexadecimal representation consists of two identical digits (00, 11, 22, ..., EE, FF). For example, #FF8844 cannot be shortened because 88 and 44 are pairs of identical digits, but FF is also a pair.
| Format | Example | Description | Usage |
|---|---|---|---|
| 6-digit Hex | #2C7DA0 | Standard hexadecimal color code | Web design, CSS, HTML |
| 3-digit Hex | #2A8 | Shorthand for #22AA88 | CSS shorthand notation |
| RGB | RGB(44, 125, 160) | Red, Green, Blue values (0-255) | Graphic design, programming |
| RGBA | RGBA(44, 125, 160, 0.5) | RGB with alpha transparency (0-1) | CSS with transparency |
| HSL | HSL(198°, 57%, 40%) | Hue, Saturation, Lightness | CSS, intuitive color adjustment |
| CMYK | CMYK(73%, 22%, 0%, 37%) | Cyan, Magenta, Yellow, Key (Black) | Print design, professional printing |
Converter Features: