03 · Converter
RGB to HEX converter, 255, 128, 64 → #FF8040.
Enter red, green and blue channel values from 0 to 255 and get the six-digit hexadecimal code for them, live.
RGB channels (0–255)
HEX
#845EC2
Guide
How RGB becomes a hex code
RGB notation writes a color as three decimal numbers, one per channel of light: red, green and blue, each from 0 to 255. Hexadecimal writes exactly the same three numbers in base 16, where each channel occupies two digits instead of up to three. Converting is therefore pure arithmetic on each channel: divide by 16, take the quotient and remainder, and map both to a digit between 0 and 9 and A and F. Nothing about the color changes — only the way the value is written down.
The shortcut is that most values people type are easy to convert by hand. 0 becomes 00, 128 becomes 80, 194 becomes C2, and 255 becomes FF. Put the three pairs together and prefix them with the hash mark CSS expects, and the color 132, 94, 194 becomes #845EC2. The hash is not part of the value itself: it tells the parser that what follows is a hexadecimal color rather than a named keyword or a function such as rgb().
Both notations describe the same color, so which one you use depends on who is reading it. RGB channels are easier to reason about numerically — adding 20 to red is a sentence a person can picture — while hex is compact, unambiguous and the format most design tools, style dictionaries and CSS custom properties expect when a value is copied out.
Using the RGB to HEX converter
Enter each channel and the hexadecimal code updates as you type, along with a full-size preview so you can see the color you are describing. The result panel carries a copy button, which is the fastest way to move the value into a stylesheet, a Tailwind theme extension or a set of design tokens. Random generates a color from the same channel inputs, and Reset returns the fields to the default value if you want to start over.
Two details are worth knowing before you paste the result. First, hex codes are case-insensitive: #845ec2 and #845EC2 are the same color, so pick one convention and keep it consistent across a codebase. Second, six-digit hex can be shortened to three digits only when each pair repeats the same digit — #FF0000 collapses to #F00, but #FF8040 does not, because neither 80 nor 40 is a doubled pair.
When a color needs transparency, six digits are not enough: CSS uses eight-digit hex, where the last pair is the alpha channel on the same 00 to FF scale. A color at 50% opacity is written by appending 80 to its six digits. If you are working in RGB rather than hex, that transparency slot is the fourth value in the rgba() function instead.
Frequently asked questions
- How do I convert RGB to HEX?
- Divide each channel by 16 and write the quotient and remainder as hexadecimal digits. For 132, 94 and 194: 132 = 8 × 16 + 4 → 84, 94 = 5 × 16 + 14 → 5E, 194 = 12 × 16 + 2 → C2, giving #845EC2. The converter above does this for you as you type.
- What is the HEX code for RGB 255, 128, 64?
- #FF8040. 255 is FF in hex, 128 is 80 and 64 is 40, so the three pairs concatenate to FF8040 — a warm orange commonly used for buttons and highlights.
- Is RGB the same thing as HEX?
- They describe the same color in different notations. RGB lists decimal values per channel from 0 to 255; HEX lists the same channels in base 16 as two digits each. Neither is more accurate than the other — a color that is #FF8040 in hex is rgb(255, 128, 64), full stop.