RGB to Hex Converter
Convert RGB to hex in seconds. Enter your red, green and blue values, each from 0 to 255, and the converter returns the matching #RRGGBB code with a live preview of the color. Click Copy and paste the code straight into your stylesheet or design file. It is free to use.
About RGB and Hex Colors
RGB describes a color with three numbers: how much red, green and blue light it contains, each from 0 to 255. Hex writes the same three numbers in base 16, two digits per channel, with a # in front. The two formats describe the same color. Hex is just the compact version that stylesheets and design tools prefer.
Take rgb(255, 87, 51), a bright orange-red. In hex it is #FF5733: FF is 255 for red, 57 is 87 for green, and 33 is 51 for blue.
How to Convert RGB to Hex
1. Enter your red, green and blue values, each between 0 and 255.
2. Check the live swatch to confirm it shows the color you meant.
3. Click Copy to grab the hex code.
4. Paste it into your CSS or design file, keeping the # at the start.
How RGB to Hex Conversion Works
Each channel becomes two hex digits. Divide the value by 16: the whole-number result is the first digit and the remainder is the second. Hex digits run 0 to 9, then A to F for 10 to 15. For rgb(255, 87, 51):
| Channel | Value | Divide by 16 | Hex digits |
| Red | 255 | 15 remainder 15 (F and F) | FF |
| Green | 87 | 5 remainder 7 | 57 |
| Blue | 51 | 3 remainder 3 | 33 |
Join the pairs and add the #: #FF5733. A small value still needs two digits, so rgb(0, 5, 10) becomes #00050A, not #0510.
How to Convert a Hex Code to RGB
This converter goes from RGB to hex. To convert a hex code to RGB, you can do it by hand in three steps:
1. Drop the # and split the six digits into three pairs: red, green, blue.
2. For each pair, multiply the first digit by 16 and add the second. Treat A to F as 10 to 15.
3. Write the three results as rgb(red, green, blue).
For #FF5733:
| Pair | Calculation | Result |
| FF | 15 × 16 + 15 | 255 |
| 57 | 5 × 16 + 7 | 87 |
| 33 | 3 × 16 + 3 | 51 |
So #FF5733 is rgb(255, 87, 51), the color we started with.
Three-digit codes are shorthand. Double each digit to expand them: #F80 becomes #FF8800, which is rgb(255, 136, 0).
Common Mistakes to Avoid
❌ Using RGB values outside 0 to 255.
✓ Solution:
Each channel has 256 possible values, 0 through 255. A value like 300 or -10 is not valid.
❌ Forgetting the # in the hex code.
✓ Solution:
In CSS and most design tools, the # is part of the code. Without it, the value may not be read as a color.
❌ Mixing up the channel order.
✓ Solution:
The order is always red, green, blue. Swap them and you get a different color: rgb(255, 87, 51) is #FF5733, but rgb(51, 87, 255) is #3357FF, a blue.
❌ Confusing RGB with RGBA.
✓ Solution:
A six-digit hex code has no transparency. If you need opacity, use an rgba() value, or an eight-digit hex code, where the last two digits set the alpha.
❌ Rounding channel values by hand.
✓ Solution:
Hex holds whole numbers from 0 to 255. If your source gives percentages or decimals, work out each channel and round once, at the end. A one-step difference is invisible to the eye but matters when you need to match a brand color exactly.
Frequently Asked Questions
Enter your red, green and blue values, each from 0 to 255, and the converter shows the #RRGGBB code. Click Copy to use it.
Hex is short for hexadecimal, a base-16 number system that uses the digits 0 to 9 and the letters A to F. A hex color code uses two hex digits for each of red, green and blue.
It is #FF5733.
No. This tool converts RGB to hex. To go the other way, use the hand method in the section above.
Split the code into three pairs, convert each pair from base 16 to a number from 0 to 255, and write them as rgb(red, green, blue). For example, #3357FF is 33 = 51, 57 = 87 and FF = 255, so rgb(51, 87, 255).
A six-digit code does not. Transparency needs an rgba() value or an eight-digit hex code. This converter outputs six-digit codes.
The page states that the conversion runs in your browser and nothing is uploaded, logged or stored.
Convert Your RGB Values
Enter your red, green and blue values, check the swatch, and copy the hex code. Keep the # when you paste it.
More Like This
Advance Loan Calculator
A loan calculator is a financial tool designed to help borrowers estimate their monthly payments, total interest, and repayment schedule for a loan. By inputting key details such as the loan amount, interest rate, and loan term, users can quickly determine how much they will need to pay each month and the overall cost of the loan.
Base64 Decode
Free Base64 decoder for text, files, and images with JWT/Base64URL support and 100% client-side, private processing.
Base64 Encode
Encode text to Base64 instantly. Type any input and get a safe, ASCII-only Base64 string in real time, with one-click copy.

