RGB to Hex Converter
To convert RGB to hex, write each number from 0 to 255 as a two-digit hexadecimal number and join them after a #. For example, rgb(255, 87, 51) is #FF5733.
Convert RGB values to a hex color code instantly. Enter red, green, and blue (0–255) and get the hex code with one click to copy.
How RGB to hex conversion works
Each RGB number (0–255) becomes exactly two hexadecimal digits: 0 is 00, 255 is FF, 128 is 80. Join the three pairs after a # and you have the hex code. For example, rgb(255, 87, 51) becomes #FF5733 because 255 = FF, 87 = 57, and 51 = 33 in hexadecimal.
Hex is the format HTML and CSS expect in most places — color: #FF5733; — while RGB is easier to read and to adjust by hand.
Frequently asked questions
What is the hex code for rgb(255, 255, 255)?
rgb(255, 255, 255) is #FFFFFF, white.
What is the hex code for rgb(0, 0, 0)?
rgb(0, 0, 0) is #000000, black.
Why does my hex code have letters in it?
Hex uses digits 0–9 plus letters A–F, because hexadecimal is base 16. A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15.
Related tools
Color Converter (all formats) · Hex to RGB · RGB to Hex · Hex to HSL · HSL to Hex · Color Picker