RGB to HEX Converter
Enter red, green, and blue values and get the HEX color code right away. It also reads RGBA, percentages, and 0 to 1 values, and can convert a whole list of colors at once. Everything runs in your browser.
Like 255, 87, 51 or rgba(255, 87, 51, 0.5)
What is an RGB color value?
An RGB value describes a color as three numbers: how much red, green, and blue light to mix. Each number runs from 0 (none) to 255 (full), so rgb(255, 87, 51) is a lot of red, some green, and a little blue, which makes orange. A HEX code stores the same three numbers in base 16, two characters each, so the same color is #FF5733. This converter turns RGB numbers into that HEX form.
Why use our RGB to HEX converter
- ·Free. No signup, no paywall, no limits.
- ·Paste what you have. Plain numbers, rgb(), rgba(), percentages, or values copied from a spreadsheet.
- ·Reads 0 to 1 values. Convert colors from game engines and 3D apps without doing the math.
- ·Whole lists at once. Convert a full palette in one go and copy every HEX code together.
- ·Runs in your browser. Nothing is uploaded, and it works offline once loaded.
How to convert RGB to HEX online
- 1
Enter your RGB values
Type the red, green, and blue numbers into the three boxes, drag the sliders, or paste a full value like rgb(255, 87, 51) into the paste box. The HEX code updates as you type.
- 2
Switch to 0 to 1 values if you need to
If your color comes from a game engine or 3D app and looks like 1, 0.341, 0.2, turn on 'Values are 0 to 1'. The boxes and the paste box then read and show values on that scale.
- 3
Set transparency if you need it
Drag the Alpha slider below 100% to make the color see-through. The HEX code gets two extra digits for the alpha, and the preview shows the color over a checkerboard.
- 4
Copy the HEX code
Click the copy button next to the format you need: the normal #RRGGBB code, the code without the #, the 8-digit code with alpha, the 3-digit short code, or a 0x value for code.
How to convert RGB to HEX by hand
Divide each RGB number by 16. The whole part of the answer is the first HEX digit and the remainder is the second. Write 10 to 15 as the letters A to F. Here is rgb(255, 87, 51) worked out:
| Channel | RGB value | Math | HEX pair |
|---|---|---|---|
| Red | 255 | 255 ÷ 16 = 15, remainder 15 | FF |
| Green | 87 | 87 ÷ 16 = 5, remainder 7 | 57 |
| Blue | 51 | 51 ÷ 16 = 3, remainder 3 | 33 |
Put the pairs together in red, green, blue order after a # and you get #FF5733. A value under 16 needs a leading zero, so 9 becomes 09, not 9. Leaving out that zero is the most common mistake when converting by hand, because it shifts every digit after it and gives a different color.
Converting 0 to 1 RGB values to HEX
Game engines and 3D apps such as Unity, Godot, and Blender often write colors with each channel from 0 to 1 instead of 0 to 255. To convert one of these, multiply each value by 255 and round to a whole number. For example, 1, 0.341, 0.2 becomes 255, 87 (86.955 rounded), and 51, which is #FF5733. Turn on "Values are 0 to 1" in the tool to do this for you.
HEX codes only have 256 steps per channel, so very small differences between 0 to 1 values can round to the same HEX code. Also note that some 3D apps show linear color values in their material settings. Those do not match a HEX code directly, so copy the HEX code from the app's own color picker when it has one.
RGBA to HEX: adding transparency
An RGBA value adds a fourth number, the alpha, from 0 (fully see-through) to 1 (fully solid). In HEX it becomes a fourth pair at the end: multiply the alpha by 255, round it, and convert it like the other channels. So rgba(255, 87, 51, 0.5) becomes #FF573380, because 0.5 × 255 rounds to 128, which is 80 in HEX. All modern browsers accept 8-digit HEX codes in CSS.
Watch the order when you use the code outside the web. Android color values put the alpha first (#AARRGGBB), so the same color is written #80FF5733 there. If a color looks wrong after you paste it into another app, check which order that app expects.
When to convert RGB to HEX
- ·Writing CSS or HTML. HEX codes are the shortest way to write a color in a stylesheet, and most style guides use them.
- ·Filling in a design app or website builder. Many color fields only accept a HEX code, even when your brand guide lists RGB.
- ·Moving colors out of a game engine. Turn 0 to 1 color values into HEX codes you can share with a web or design team.
- ·Converting a palette. Paste a list of RGB colors from a spreadsheet or document and get all the HEX codes in one step.
Frequently asked questions
- How do I convert RGB to HEX?
- Enter the red, green, and blue values (each from 0 to 255) in the converter above, or paste a value like rgb(255, 87, 51). The HEX code appears right away, in this case #FF5733. To do it by hand, divide each number by 16, write the whole part and the remainder as HEX digits, and join the three pairs.
- What is the formula for RGB to HEX?
- For each channel, the first HEX digit is the number divided by 16 (whole part only) and the second digit is the remainder. Numbers 10 to 15 are written as the letters A to F. Then put the red, green, and blue pairs together after a #. For example, 87 ÷ 16 is 5 with 7 left over, so 87 becomes 57.
- How do I convert RGBA to HEX?
- Convert red, green, and blue as usual, then turn the alpha into a fourth pair. Multiply the alpha (0 to 1) by 255, round it, and write it in HEX. For example, rgba(255, 87, 51, 0.5) has an alpha of 0.5 × 255 = 127.5, which rounds to 128, or 80 in HEX. The result is #FF573380.
- How do I convert RGB values from 0 to 1 into HEX?
- Multiply each value by 255 and round to the nearest whole number, then convert as usual. In the tool, turn on 'Values are 0 to 1' and paste the values. For example, 1, 0.341, 0.2 becomes 255, 87, 51, which is #FF5733.
- Why does my RGB value have no 3-digit short HEX code?
- A short code like #F53 only works when both digits in every pair are the same, so #F53 stands for #FF5533. Most colors do not have doubled pairs, so they can only be written with six digits. The tool shows 'Not possible for this color' when that is the case.
- Can I convert a list of RGB colors at once?
- Yes. Open the Many colors tab and paste your colors one per line. Each line can be plain numbers, rgb(), or rgba(), and values copied from spreadsheet cells work too. Click the copy button to copy all the HEX codes, one per line. Lines that are not valid are marked and left out of the copy.
- Should HEX codes be uppercase or lowercase?
- It does not matter to browsers or design apps. #FF5733 and #ff5733 are the same color. Pick whichever matches your project's style. The Uppercase HEX switch changes every result at once.
- Is my data sent anywhere?
- No. Every conversion runs in your browser, and nothing is uploaded to a server.