RGB to Hex Converter

Turn RGB values into CSS hex colors

Free RGB to hex converter for CSS. Set red, green, and blue (0 to 255), optionally alpha, and copy #RRGGBB or rgba(). Everything stays in the browser.

Starting from a hex string like #FF5733? Use the Hex to RGB Converter.
Picker ignores alpha. Use A% for transparency.
Hex #292524
Lower #292524
rgb rgb(41, 37, 36)
rgba rgba(41, 37, 36, 1)
#RGBA #292524FF

RGB to hex at a glance

Known values

rgb(255, 87, 51)#FF5733
rgb(41, 37, 36)#292524
rgb(255, 255, 255)#FFFFFF
rgb(0, 0, 0)#000000

Channel to hex

000
150F
1610
255FF

RGB to hex guide

How RGB becomes hex

CSS rgb() uses three integers from 0 to 255. Hex is the same three bytes written in base 16. Pair them: red, then green, then blue. Prefix # so the stylesheet parser treats it as a color, not a word.

When to keep rgb()

Keep rgb() when you animate a single channel or generate colors in code. Switch to hex in static CSS. It is shorter and every design tool speaks it.

RGB to hex FAQ

How do I convert RGB to hex?

Write each channel as two hex digits. 255 is FF, 87 is 57, 51 is 33, so rgb(255, 87, 51) is #FF5733. This tool does that as you move the sliders.

What is the formula for RGB to hexadecimal?

Clamp each of R, G, and B to 0-255. Convert the integer to base 16 and pad to two characters. Prefix with #. CSS also accepts lowercase #ff5733.

Does RGB to hex support alpha?

Yes. Alpha 0-100% maps to a byte 00-FF. You get rgba(r, g, b, a) and #RRGGBBAA. Older browsers ignore the last two hex digits, so keep rgb() when you need a solid color.

Is hex the same as RGB?

They describe the same sRGB triple. Hex is a compact spelling for stylesheets. rgb() is easier to tweak by channel. Use the Hex to RGB converter when you start from a hex string.

Does this RGB to hex converter upload my color?

No. Conversion runs in this tab. There is no API call.