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.
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.
| rgb(255, 87, 51) | #FF5733 |
| rgb(41, 37, 36) | #292524 |
| rgb(255, 255, 255) | #FFFFFF |
| rgb(0, 0, 0) | #000000 |
| 0 | 00 |
| 15 | 0F |
| 16 | 10 |
| 255 | FF |
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.
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.
Paste a hex string into the Hex to RGB converter. Preview fills on an SVG in the SVG Viewer.
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.
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.
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.
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.
No. Conversion runs in this tab. There is no API call.