ImageColorPick

RGB to HEX Converter

To convert RGB to HEX, write each of the three values from 0 to 255 as a two-digit hexadecimal number and join them after a #. For example rgb(30, 144, 255) becomes #1E90FF. Type your numbers below to see the hex code, a preview and the HSL and CMYK values at once.

RGB to HEX converter

The live converter needs JavaScript. Example: #1E90FF = rgb(30, 144, 255) = hsl(210, 100%, 56%) = cmyk(88%, 44%, 0%, 0%).

The formula

RGB to HEX, step by step
StepWhat to doExample: dodger blue
1Take each RGB value (0–255).30, 144, 255
2Write each as two hexadecimal digits (00–FF).30 → 1E, 144 → 90, 255 → FF
3Join them after a #.#1E90FF

To convert one value by hand, divide it by 16. The whole number is the first digit and the remainder is the second, with 10 to 15 written as A to F. For 144: 144 ÷ 16 = 9 with remainder 0, so 90. For 30: 1 with remainder 14, so 1E.

Common RGB values in hex

RGB and HEX side by side
ColorRGBHEX
Red255, 0, 0#FF0000
Lime green0, 255, 0#00FF00
Blue0, 0, 255#0000FF
White255, 255, 255#FFFFFF
Black0, 0, 0#000000
Mid gray128, 128, 128#808080
Dodger blue30, 144, 255#1E90FF
Tomato255, 99, 71#FF6347
Gold255, 215, 0#FFD700
Rebecca purple102, 51, 153#663399
Teal0, 128, 128#008080
Saddle brown139, 69, 19#8B4513

HSL rounded to whole numbers. CMYK from the simple formula below, without a color profile.

Decimal to hexadecimal
DecimalHexDecimalHex
00012880
161014490
3220160A0
5133170AA
6440192C0
8555204CC
9660224E0
10266238EE
11270240F0
11977255FF

When you need which

Both codes describe exactly the same color. HEX is shorter and is what CSS, HTML and most design apps show by default. RGB numbers are what you see in Office programs, video tools, game engines and many programming libraries. Converting between them never changes the color.

Frequently asked questions

How do I convert RGB to HEX?

Convert each value from 0 to 255 into a two-digit hexadecimal number, then write them in the order red, green, blue after a #. For example 255, 99, 71 becomes FF, 63, 47, so the hex code is #FF6347.

What is 255, 255, 255 in hex?

255 in hexadecimal is FF, so rgb(255, 255, 255) is #FFFFFF, which is white. Likewise rgb(0, 0, 0) is #000000, black, and rgb(128, 128, 128) is #808080, a middle gray.

Can I convert RGBA to hex?

Yes. CSS accepts an eight-digit hex code where the last pair is the transparency: 255 is FF (opaque) and about 50% is 80. This converter handles the color part; add the alpha pair yourself if you need it.

Why does my RGB value give an error?

Each value must be a whole number from 0 to 255. Values above 255 or decimals are not valid in the standard 8-bit RGB used on the web. Percentages, as in rgb(50%, 0%, 0%), must first be multiplied by 2.55.

Is HEX more accurate than RGB?

No. A six-digit hex code and three numbers from 0 to 255 hold exactly the same information, so every RGB color has one hex code and back. Only the way of writing differs.

Last updated: October 15, 2026