CONVERTER · MATH · COLOR

RGB to Hex Converter

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.

349

RGB to Hex Converter

RGB in — hex out. Or paste a hex code for the reverse trip.

The red channel. 0 is none, 255 is full red. Whole numbers 0 to 255.

The green channel. Whole numbers 0 to 255.

The blue channel. Whole numbers 0 to 255.

Optional reverse lookup: paste any #RRGGBB or #RGB code to get its RGB values.

Result—Enter values above

Enter values to see the result.

How RGB becomes hex

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:

ChannelDecimalHex
Red255FF
Green9963
Blue7147

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.

The 3-digit shorthand (and when it breaks)

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.

Named colors, decoded

CSS's 148 named colors are just hex codes with nicknames. A few, with their RGB values:

ColorHexRGBSwatch
Tomato#FF6347255, 99, 71
Coral#FF7F50255, 127, 80
Gold#FFD700255, 215, 0
Lime#00FF000, 255, 0
Teal#0080800, 128, 128
Navy#0000800, 0, 128
Hot pink#FF69B4255, 105, 180
Rebecca purple#663399102, 51, 153

Output · formula · meaning

OutputFormulaWhat it means
Hex code# + hex(R) + hex(G) + hex(B)#FF6347 at the defaults — paste it straight into CSS.
Reverse RGBeach hex pair → decimal#FF6347 → 255, 99, 71 — the same color, decoded.

Who uses this

  • Web developers: translating a designer's RGB values into CSS hex (or the reverse) dozens of times a day.
  • Designers: checking whether a hex code from a brand guide matches the RGB in a mockup.
  • Email marketers: email clients are picky about color formats — hex is the safe choice everywhere.
  • Students: the RGB–hex mapping is the cleanest possible introduction to hexadecimal.

Accuracy & limitations

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.

Cite this calculatorBright Side Kit. “RGB to Hex Converter.” brightoolbox.com, 2026.Bright Side Kit. "RGB to Hex Converter." https://brightoolbox.com/rgb-to-hex-converter/ Accessed October 23, 2026.
Embed this calculator

Paste this into any web page to embed the live calculator. The “Bright Side Kit” link below it must stay intact.

Frequently asked questions

How do I convert RGB to hex?

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.

How do I convert hex to RGB?

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.

What is 3-digit hex shorthand?

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.

Why do developers use hex instead of RGB?

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().

What does the # mean in a hex color?

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.

How many colors can RGB/hex express?

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.

Is the conversion lossless?

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.