RGB to HEX Converter
RGB describes a color as three decimal channels from 0 to 255. Converting to HEX means writing each channel as a two-digit hexadecimal number and joining them behind a leading hash, giving the compact codes CSS authors use every day.
Enter red, green, and blue values below and the matching #rrggbb code updates live, with a swatch so you can confirm the color at a glance. Everything is computed locally — your values are never sent anywhere.
#6c72ff| Red | Green | Blue | HEX |
|---|---|---|---|
0 | 0 | 0 | #000000 |
255 | 255 | 255 | #ffffff |
255 | 0 | 0 | #ff0000 |
108 | 114 | 255 | #6c72ff |
26 | 147 | 111 | #1a936f |
rgb(108, 114, 255)→#6c72ff108 → 6c, 114 → 72, 255 → ff, concatenated with a leading #.
Frequently asked questions
How do I turn RGB into a HEX code manually?
Convert each channel from decimal to two-digit hexadecimal, padding with a leading zero when needed, then join them as #RRGGBB. For example 108 becomes 6c and 255 becomes ff.
Why are some HEX codes shortened to three digits?
When all three channel pairs repeat (like #aabbcc) the code can be written as #abc. This tool outputs the full six-digit form, which always works.
What range are RGB values in?
Each of red, green, and blue runs from 0 to 255. Values are clamped to that range, since a single byte per channel cannot represent anything outside it.
Does this happen in my browser?
Yes, the conversion is pure JavaScript running locally. No RGB or HEX data is uploaded.