What is the RGB to Hex Color Calculator?
This tool converts a color defined by its Red, Green and Blue channels into the hexadecimal color code used across the web, CSS, design software and HTML. Each channel ranges from 0 to 255, and the calculator turns those three numbers into a familiar code like #FF6347 along with its raw decimal value. A live swatch shows you exactly what the color looks like.
How to use it
Enter a value between 0 and 255 for each of the Red, Green and Blue inputs. Press calculate and you'll see the hex code, the decimal color value, and how each individual channel maps to its two-digit hex pair. Copy the hex code straight into your CSS or design app.
The formula explained
Each channel is an 8-bit number (0-255), which is exactly two hexadecimal digits (00-FF). To get the combined decimal value, multiply red by 65536 (164), green by 256 (162), and add blue: $$\text{decimal} = \text{R}\times 65536 + \text{G}\times 256 + \text{B}$$. The hex code is simply each channel written in base-16 and joined with a leading #:
$$\text{Hex} = \#\,\text{hex}_2\!\left(\text{Red}\right)\,\text{hex}_2\!\left(\text{Green}\right)\,\text{hex}_2\!\left(\text{Blue}\right)$$
Worked example
Take RGB(255, 99, 71) — "tomato". Red 255 = FF, Green 99 = 63, Blue 71 = 47, giving the hex code #FF6347. The decimal value is $$255\times 65536 + 99\times 256 + 71 = 16{,}711{,}680 + 25{,}344 + 71 = 16{,}737{,}095$$
FAQ
Why are there exactly two hex digits per channel? Because 255 in hexadecimal is FF — two digits cover every value from 0 to 255.
Can I use the decimal value in code? Yes. Many graphics APIs accept the single integer (e.g. 16737095) as a packed color value.
What's the difference between hex and RGB? They describe the same color in different notations — hex is more compact, RGB is more readable. This tool shows both.