Flagship color workspace
RGB to Hex Converter
Parse integer or percentage RGB, modern CSS, legacy commas, and alpha. Then copy normalized Hex, LAB/LCH, OKLCH, snippets, perceptual states, and measured contrast without re-entering the color.
Synchronized color
#FF5733Parsed as RGB; malformed or out-of-range channels are rejected, never silently clamped.
Integer or percentage RGB, modern or legacy CSS, Hex with optional alpha, HSL, HSV, OKLCH, LAB, LCH, CMYK, or a CSS name.
Adjust channels
Share this exact input
?color=FF5733One input, implementation-ready output
Color workspace
Hex
#RRGGBB
#FF5733CSS RGB
Modern space syntax
rgb(255 87 51)Legacy RGB
Comma syntax
rgb(255, 87, 51)RGB %
Percentage channels
rgb(100% 34.1% 20%)HSL
CSS hue, saturation, lightness
hsl(11 100% 60%)HSV / HSB
Design-tool model
hsv(11, 80%, 100%)OKLCH
Perceptual CSS color
oklch(68% 0.21 33.7)LAB
CSS Lab, D50
lab(61.03% 63.55 55.96)LCH
CSS LCH, D50
lch(61.03% 84.67 41.37)CMYK
Unprofiled approximation
cmyk(0%, 66%, 80%, 0%)How to Convert RGB to Hex
Each RGB channel (0-255) becomes a two-digit hexadecimal pair. The three pairs concatenated with a leading # form the hex code:
- Divide the channel value by 16. The whole-number quotient is the first hex digit.
- The remainder is the second hex digit (10=A, 11=B, 12=C, 13=D, 14=E, 15=F).
- Repeat for red, green, and blue.
- Concatenate the pairs as #RRGGBB.
Example: convert rgb(255, 87, 51) to hex
255 ÷ 16 = 15 remainder 15 → FF
87 ÷ 16 = 5 remainder 7 → 57
51 ÷ 16 = 3 remainder 3 → 33
Result: #FF5733
How to Use the RGB to Hex Converter
Enter integer or percentage channels using modern CSS, legacy commas, a bare RGB triplet, or an alpha-aware format. The synchronized workspace preserves transparency, rejects malformed input, and shows normalized Hex, RGB, HSL, HSV, LAB/LCH, OKLCH, and an unprofiled CMYK approximation.
Understanding RGB Color Model
RGB stands for Red, Green, Blue - the three primary colors of light. Computer displays create colors by mixing these three light sources at different intensities. Each channel has 256 levels (0-255), allowing for 16,777,216 unique colors. When all channels are at 0, you get black; when all are at 255, you get white.
Common Use Cases
Converting RGB to hex is essential when copying colors from JavaScript color pickers to CSS stylesheets, when working with design specifications that provide RGB values, or when you need a more compact color representation. Many brand guidelines specify colors in RGB, but web implementations require hex codes.
RGB to Hex Conversion Table
RGB and hex values for the most commonly used colors. Click any hex code to load it into the converter above.
| Color | Name | Hex | RGB |
|---|---|---|---|
| Black | #000000 | rgb(0, 0, 0) | |
| White | #FFFFFF | rgb(255, 255, 255) | |
| Red | #FF0000 | rgb(255, 0, 0) | |
| Lime | #00FF00 | rgb(0, 255, 0) | |
| Blue | #0000FF | rgb(0, 0, 255) | |
| Yellow | #FFFF00 | rgb(255, 255, 0) | |
| Cyan | #00FFFF | rgb(0, 255, 255) | |
| Magenta | #FF00FF | rgb(255, 0, 255) | |
| Silver | #C0C0C0 | rgb(192, 192, 192) | |
| Gray | #808080 | rgb(128, 128, 128) | |
| Maroon | #800000 | rgb(128, 0, 0) | |
| Olive | #808000 | rgb(128, 128, 0) | |
| Green | #008000 | rgb(0, 128, 0) | |
| Purple | #800080 | rgb(128, 0, 128) | |
| Teal | #008080 | rgb(0, 128, 128) | |
| Navy | #000080 | rgb(0, 0, 128) | |
| Orange | #FFA500 | rgb(255, 165, 0) | |
| Pink | #FFC0CB | rgb(255, 192, 203) | |
| Gold | #FFD700 | rgb(255, 215, 0) | |
| Brown | #A52A2A | rgb(165, 42, 42) | |
| Coral | #FF7F50 | rgb(255, 127, 80) | |
| Indigo | #4B0082 | rgb(75, 0, 130) | |
| Violet | #EE82EE | rgb(238, 130, 238) | |
| Salmon | #FA8072 | rgb(250, 128, 114) |
Need a value that is not listed? Browse the full color library — every hex code has a page with its RGB, HSL, CMYK and OKLCH values, contrast ratios, tints, shades and matching palette colors.
Frequently Asked Questions about RGB to Hex Converter
Use integers from 0 to 255 or percentages from 0% to 100% for red, green, and blue. Out-of-range or malformed channels are rejected with a clear error rather than silently clamped.
Hex codes are more compact and widely used in CSS and HTML. They're also easier to copy and share. Many design tools and color pickers display hex codes by default.
No, hex codes are not case-sensitive. #FF5733, #ff5733, and #Ff5733 all represent the same color. Our converter outputs uppercase for consistency.
Yes. Enter rgba(), modern rgb() slash syntax, or 4/8-digit hex. The workspace preserves alpha and produces normalized #RRGGBBAA plus modern and legacy CSS syntax.
Keep the color moving
Useful next steps
Your latest color stays in the local workspace when the next tool uses it.