RGB to HEX Converter
Turn red, green and blue values into a six-digit hexadecimal color code with our free RGB to HEX converter. Enter three whole numbers from 0 to 255 to see the resulting color immediately, copy it for your website or design project, and explore matching tints and shades. The tool also provides CSS RGB, HSL, HSV and approximate CMYK values, with all calculations performed directly in your browser.
Shades and Tints
Explore lighter and darker variations. Click any swatch to copy its HEX code.
How to convert RGB to HEX
Enter the red, green and blue channels in their respective fields. For example, 47, 125, 225 becomes #2F7DE1.
Copy the format you need for CSS, interface design or digital artwork. All calculations run locally in your browser.
Frequently Asked Questions
What is the valid RGB range?
Each channel must be a whole number between 0 and 255.
Why does RGB use three numbers?
The numbers represent the red, green and blue intensities of a color.
What is the difference between HEX and RGB?
Both represent the same RGB color using different notation.
Is CMYK exact?
No. This is a mathematical approximation. Print conversion depends on the ICC profile and printing conditions.
COLOR CONVERSION GUIDE
How to Turn RGB Values into HEX Color Codes
Learn how three decimal channel values become a compact hexadecimal code, how to calculate the result manually, and how to use it in your creative workflow.
Understanding RGB channels
Each channel in an ordinary 8-bit RGB color has 256 possible values, from 0 to 255. Red, green and blue light combine to produce more than 16 million possible combinations. Equal channel values create neutral grays, while changing one channel independently alters the resulting color.
Reading the HEX result
A six-digit hexadecimal code stores the same three channel values in pairs, using the digits 0–9 and letters A–F. The first pair belongs to red, the middle pair to green and the last pair to blue. The hash character identifies the notation in CSS.
How to calculate RGB to HEX manually
Divide each decimal channel value by 16. The whole-number quotient gives the first hexadecimal digit and the remainder gives the second. Replace values 10 through 15 with A through F, respectively. Always keep two digits per channel, including leading zeros.
Red: 47
47 = 2 × 16 + 15
15 = F → 2F
Green: 125
125 = 7 × 16 + 13
13 = D → 7D
Blue: 225
225 = 14 × 16 + 1
14 = E → E1
rgb(47, 125, 225) → #2F7DE1
RGB to HEX conversion examples
Compare these standard RGB values and their equivalent hexadecimal codes. Each pair of values represents the same color in sRGB.
| Color | RGB | HEX |
|---|---|---|
| Black | 0, 0, 0 | #000000 |
| White | 255, 255, 255 | #FFFFFF |
| Red | 255, 0, 0 | #FF0000 |
| Lime | 0, 255, 0 | #00FF00 |
| Blue | 0, 0, 255 | #0000FF |
| Orange | 255, 128, 0 | #FF8000 |
| Sky blue | 135, 206, 235 | #87CEEB |
| Purple | 128, 0, 128 | #800080 |
| Slate gray | 112, 128, 144 | #708090 |
| VectorElements Green | 138, 231, 73 | #8AE749 |
Using hexadecimal colors in design and development
From image samples to brand palettes
When an eyedropper returns three RGB numbers, converting them to HEX makes the color easy to record in a brand guide or transfer into another design tool. Make sure both applications use the same color space for consistent results.
From RGB values to CSS
Use a hexadecimal value in properties such as color, background-color or border-color. For example, background-color: #2F7DE1; produces the same opaque sRGB color as background-color: rgb(47, 125, 225);.
Common mistakes when converting RGB values
Keep channel values within 0–255 and preserve their order. A value of 5 must become 05, not 5, so that each channel occupies exactly two hexadecimal digits. Percentage-based CSS values require conversion to the 0–255 scale before entering them into this tool. Transparency is a separate alpha channel and is not included in the six-digit result.
Working with other color models
Use HSL to explore hue and lightness or HSV to adjust saturation and value. These models offer alternative ways to describe the same RGB color. The approximate CMYK result is useful as a reference, but professional printing requires a suitable ICC profile and color-managed conversion.
Already have a HEX color code?
Use our reverse converter to find the corresponding red, green and blue channel values.
HEX to RGB Converter →