Home Tools Categories Guides About Contact
Color converter

RGB to HEX Color Converter

Enter RGB values and get the matching 6-digit HEX code instantly, with a live swatch preview and a one-click copy.

Works with rgb(11, 95, 255), rgb(11,95,255), 11, 95, 255, or 11 95 255. Converts as you type.

Result

#0B5FFF

RGB: rgb(11, 95, 255)

How RGB to HEX conversion works

An RGB color is three numbers from 0 to 255 — how much red, green, and blue light to mix. A HEX code stores the same three numbers in base-16 (hexadecimal), where the digits run 0–9 and then A–F for 10–15. Because 255 in base-16 is FF, every channel fits in exactly two characters, and the whole color fits in six.

To convert one channel, divide it by 16. The whole-number result is the first HEX digit and the remainder is the second. For rgb(29, 78, 216): 29 ÷ 16 = 1 remainder 13 → 1D; 78 ÷ 16 = 4 remainder 14 → 4E; 216 ÷ 16 = 13 remainder 8 → D8. Put them together after a # and you get #1D4ED8.

Small values need a leading zero so each channel stays two characters: 11 becomes 0B, and 0 becomes 00. That's why rgb(11, 95, 255) is #0B5FFF.

Common RGB to HEX values

Click any row to load it into the converter.

ColorRGBHEX
Whitergb(255, 255, 255)#FFFFFF
Blackrgb(0, 0, 0)#000000
Redrgb(255, 0, 0)#FF0000
Lime greenrgb(0, 255, 0)#00FF00
Bluergb(0, 0, 255)#0000FF
Yellowrgb(255, 255, 0)#FFFF00
Cyanrgb(0, 255, 255)#00FFFF
Magentargb(255, 0, 255)#FF00FF
Grayrgb(128, 128, 128)#808080
Silverrgb(192, 192, 192)#C0C0C0
Navyrgb(0, 0, 128)#000080
Orangergb(255, 165, 0)#FFA500

Where you'll use HEX codes

HEX is the standard way to share a single color: website and CSS styles, brand style guides, Canva and Figma color pickers, and print-on-demand design tools all accept it. It's also what most color-matching tools expect — including our Paint Color Matcher, which turns a HEX code into the closest real paint from 18 brands.

If a design app gives you RGB values, convert them here, then paste the HEX code wherever you need it. Remember that screen colors and paint never match perfectly, so check a physical sample before you buy paint.

RGB to HEX FAQ

How do you convert RGB to HEX?

Each of the three RGB values (red, green, blue, 0-255) is converted individually to a two-digit base-16 (hexadecimal) number, then the three pairs are joined with a # in front — for example, RGB(29, 78, 216) becomes #1D4ED8.

Why do HEX codes only use the characters 0-9 and A-F?

HEX is base-16, so each digit needs 16 possible values. The digits 0-9 cover ten of those, and the letters A-F (representing 10-15) cover the rest, letting each color channel be written in exactly two characters instead of three.

Why does my HEX code have a 0 in it?

Every channel must be exactly two HEX digits. Values below 16 only need one digit, so a leading 0 is added — for example, a green value of 11 becomes 0B, not B. Without the padding the code would be the wrong length and the colors would shift.

Can I use RGB and HEX interchangeably in CSS?

Yes. rgb(11, 95, 255) and #0B5FFF describe exactly the same color, and modern browsers accept either anywhere a color is allowed. HEX is shorter to paste; rgb() is easier to read and to extend with transparency, as in rgb(11 95 255 / 50%).

Related color tools