↑ ↓ to moveEnter to openEsc to close

RGB to HEX converter

Set red, green and blue with the sliders or type them in, and the HEX code builds itself from the three channels. Add alpha to get an eight-digit code.

  • HEX
  • HEX8

How your HEX was built

 
Bulk mode
  

How to convert RGB to HEX by hand

Each RGB channel is a whole number from 0 to 255. Turn each one into two hexadecimal digits and write them side by side after a #.

To get the two digits, divide the number by 16:

  • the whole-number result is the first digit;
  • the remainder is the second digit.

Digits above 9 are written as letters: 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F.

Worked example: rgb(217, 72, 28)

ChannelValue÷ 16RemainderHex pair
Red21713 (D)9D9
Green724848
Blue28112 (C)1C

Join the pairs and you get #D9481C. The tool shows the same table for whatever values you enter.

A second example with padding

rgb(15, 118, 110) gives 15 ÷ 16 = 0 remainder 15, so red is 0F, not F. Always write two digits per channel, padding with a leading zero, or the code will shift: #F766E is not a valid color, while #0F766E is.

Using the tool

  • Drag the Red, Green and Blue sliders, or type exact numbers in the boxes next to them. Values outside 0 to 255 are clamped.
  • Move Alpha below 1 to get an eight-digit code. An alpha of 0.5 becomes 80 (0.5 × 255 = 127.5, rounded to 128).
  • Paste a whole rgb() or rgba() string, or three numbers like 217, 72, 28, into the paste field and the sliders jump to it.
  • The HEX8 line always shows the eight-digit form, with FF for fully opaque colors, for tools that insist on alpha.

Where RGB values come from

You will usually meet RGB values in:

  • design tools that show "R 217 G 72 B 28" in an inspector panel;
  • brand guidelines, which often give RGB for screens and CMYK for print side by side;
  • code: Color(217, 72, 28) in Processing, new Color(217, 72, 28) in Java, rgb() in CSS;
  • photo editors and the eyedropper in Paint or GIMP.

HEX is easier to copy and paste and to search for, so converting is mostly about convenience. The color itself does not change.

Bulk conversion

Open Bulk mode and paste one color per line. Each line can be 28, 27, 24, 28 27 24, rgb(28, 27, 24) or rgba(15, 118, 110, 0.5). Results appear as you type, with eight-digit codes for any line that has transparency. Lines the parser cannot read are flagged in place so the output stays aligned with the input.

Percentages and floats

Some software gives RGB as percentages (rgb(85%, 28%, 11%)) or as 0 to 1 floats (0.851, 0.282, 0.110). Multiply by 255 first and round:

  • 85% × 255 = 216.75 → 217
  • 0.282 × 255 = 71.9 → 72

The paste field accepts percentage syntax directly. For floats, convert them first or use the color converter, which reads color(srgb 0.851 0.282 0.110).

Quick reference

DecimalHexDecimalHex
00012880
1610160A0
3220192C0
5133204CC
6440224E0
10064240F0
10266250FA
1277F255FF

Web-safe colors from the 1990s use only 00, 33, 66, 99, CC and FF, which correspond to 0, 51, 102, 153, 204 and 255.

Going the other direction is covered by HEX to RGB. For print values, try RGB to CMYK. If you just need to convert a single number, decimal to hex handles values of any size and shows the same division method.

FAQ

What is #FFFFFF in RGB?

White: rgb(255, 255, 255). #000000 is black, rgb(0, 0, 0).

Why do I get a different HEX than another converter?

Usually rounding. If your source values are decimals (for example 127.5), some tools round half up to 128 (80) and others truncate to 127 (7F). The difference is one step and invisible to the eye.

Do I need the # sign?

In CSS, yes. Many design tools accept the code without it.

Can RGB values go above 255?

Not in sRGB HEX. Wide-gamut and HDR formats can describe brighter or more saturated colors, but those need CSS color() notation, not HEX.