RGB to HEX Converter
Convert RGB values to a hex color code instantly, with sliders, a live preview and one-click copy.
Convert RGB values to a HEX code
The RGB to HEX Converter turns red, green, and blue values into a hexadecimal color code instantly. Drag the sliders or type exact channel values from 0 to 255 and watch the hex code and color preview update live. One click copies the result for your CSS or design tool. It runs entirely in your browser, so it is fast and private.
From RGB to HEX, explained
RGB describes a color with three numbers from 0 to 255, one each for red, green, and blue. A hex code packs those same three numbers into a compact string by writing each as a two-digit hexadecimal value. For example, rgb(109, 139, 255) becomes #6d8bff: 109 is 6d, 139 is 8b, and 255 is ff. The converter handles this math for you and always pads single digits so the code is valid.
How to use it
- Set the Red, Green, and Blue sliders, or type exact values.
- The hex code and live preview update instantly.
- Click Copy to grab the hex value.
When you need hex instead of RGB
Hex codes are the most common way to specify colors in CSS, design software, and brand guidelines because they are compact and unambiguous. If you sampled a color as RGB from an image editor, a screenshot tool, or a canvas, converting to hex gives you a portable value you can drop into a stylesheet, a theme file, or a documentation page. Hex is also the format most developers recognize at a glance.
Tips for picking colors
- Pure primaries are easy to remember: red is
#ff0000, green#00ff00, blue#0000ff. - Equal R, G, and B values always produce a shade of gray.
- To darken a color, lower all three channels proportionally; to lighten it, raise them.
Private and free
This converter does all calculations locally in your browser. Nothing is uploaded or stored, and there are no limits — convert as many colors as you like.
Frequently asked questions
How do I convert RGB to HEX?
Convert each of the red, green, and blue values (0–255) to a two-digit hexadecimal number and join them with a leading #. For example, rgb(109,139,255) becomes #6d8bff.
What range are RGB values?
Each channel ranges from 0 to 255. Values outside this range are clamped automatically.
Does it include a color preview?
Yes. A live swatch shows the exact color as you adjust the sliders.
Is my data private?
Yes. All conversion happens in your browser with nothing uploaded or stored.