RGB to Hex Converter
RGB in — hex out. Or paste a hex code for the reverse trip.
CONVERTER · MATH · COLOR
Every color on the web is three numbers wearing a disguise. RGB(255, 99, 71) — full red, a third green, a quarter blue — is the hex code #FF6347, better known as tomato. Each channel maps to two hex digits: 255 becomes FF, 99 becomes 63, 71 becomes 47. Below: a live two-way converter (type RGB values, get the hex — or paste any hex code for the reverse), a named-color quick table, and the shorthand rule that trips everyone up.
RGB in — hex out. Or paste a hex code for the reverse trip.
Each of the three channels (red, green, blue) holds a value from 0 to 255 — that's 256 levels, or exactly what two hexadecimal digits can express (00 to FF). Converting is just writing each channel in base 16:
| Channel | Decimal | Hex |
|---|---|---|
| Red | 255 | FF |
| Green | 99 | 63 |
| Blue | 71 | 47 |
Stick a # in front and concatenate: #FF6347. That's it — no compression, no rounding, a pure relabeling of the same three numbers. The converter above does both directions live: change any channel and the hex updates; paste a hex code and the channels fill in.
CSS lets you write #f63 instead of #ff6633 — each digit is simply doubled (f→ff, 6→66, 3→33). But shorthand only works when each pair is a doubled digit: #FF6347 can never be shortened, because 63 and 47 aren't doubled digits. Try pasting a non-shortable code like #FF6347 into the reverse lookup and asking for shorthand — the converter will tell you it can't be done.
CSS's 148 named colors are just hex codes with nicknames. A few, with their RGB values:
| Color | Hex | RGB | Swatch |
|---|---|---|---|
| Tomato | #FF6347 | 255, 99, 71 | |
| Coral | #FF7F50 | 255, 127, 80 | |
| Gold | #FFD700 | 255, 215, 0 | |
| Lime | #00FF00 | 0, 255, 0 | |
| Teal | #008080 | 0, 128, 128 | |
| Navy | #000080 | 0, 0, 128 | |
| Hot pink | #FF69B4 | 255, 105, 180 | |
| Rebecca purple | #663399 | 102, 51, 153 |
| Output | Formula | What it means |
|---|---|---|
| Hex code | # + hex(R) + hex(G) + hex(B) | #FF6347 at the defaults — paste it straight into CSS. |
| Reverse RGB | each hex pair → decimal | #FF6347 → 255, 99, 71 — the same color, decoded. |
The conversion is exact and lossless — RGB and hex are two notations for the same 24-bit color, so there is nothing to round. What the converter does not do: alpha/transparency (RGBA), HSL/CMYK color spaces, color-blindness simulation, or contrast-ratio checks. Named colors follow the CSS Color Module Level 4 keyword list. Colors may render slightly differently across screens — that's your display's color profile, not the math.
Bright Side Kit. "RGB to Hex Converter." https://brightoolbox.com/rgb-to-hex-converter/ Accessed October 23, 2026.Write each channel (red, green, blue) as a two-digit hexadecimal number and concatenate them after a #. RGB(255, 99, 71) becomes #FF6347: 255→FF, 99→63, 71→47. The converter above does it live as you type.
Split the six hex digits into three pairs and convert each pair from hexadecimal to decimal: #FF6347 → FF=255, 63=99, 47=71 → RGB(255, 99, 71). Paste any hex code into the reverse field above and the channels fill in automatically.
CSS lets you compress hex codes where each pair is a doubled digit: #ff6633 becomes #f63 (each digit doubled: f→ff, 6→66, 3→33). But #FF6347 can't be shortened — 63 and 47 aren't doubled digits. Only about 4,096 of the 16.7 million colors have a shorthand form.
Mostly history and habit: hex is shorter (#FF6347 vs rgb(255,99,71)), it was the only format early CSS supported, and it reads as a single token rather than a function call. They're mathematically identical — every hex color has an exact RGB equivalent and vice versa. Modern CSS accepts both plus newer formats like oklch().
It's just a prefix that says “the digits after this are hexadecimal” — borrowed from assembly-language notation. In CSS it's required (#FF6347 works, FF6347 doesn't). Some contexts (Android XML, older design tools) use 0x instead, which means the same thing.
16,777,216 — 256 levels per channel, cubed (256³). That's more than the human eye can distinguish, which is why 24-bit color is called “true color.” The shorthand #RGB form only covers 4,096 of them.
Yes — perfectly. RGB and hex are two notations for the same three 8-bit numbers, so nothing is rounded, compressed, or approximated in either direction. If a color looks different after converting, the problem is your screen's color profile, not the math.