What is an RGB to HEX converter and why use it?
An RGB to HEX converter turns the three color channels of rgb(37, 99, 235) into the compact hex code #2563eb. Both notations are valid in CSS and describe exactly the same color.
Hex is shorter and is the standard in design tools, brand guidelines and HTML attributes, so you will often need to convert values from code, screenshots or color pickers into hex.
How to use this tool
Enter red, green and blue
Type a whole number from 0 to 255 in each field, or use the color picker.
Check the preview
The swatch updates as you type. Out-of-range values show an error.
Copy the hex code
Press Copy HEX, or Copy without # if you need the bare digits.
How RGB is converted to HEX
Convert each channel from decimal to a two-digit base-16 number and join them after a #. For rgb(255, 87, 51): 255 = ff, 87 = 57, 51 = 33, giving #ff5733.
Values below 16 need a leading zero, so 5 becomes 05 and rgb(0, 0, 5) is #000005.
HEX = # + hex(R) + hex(G) + hex(B)hex(n) = n in base 16, padded to 2 digitsFAQ
How do I convert RGB to hex?
Convert red, green and blue to two-digit hexadecimal numbers and put them after a #. rgb(0, 128, 255) is #0080ff.
What range can RGB values be?
Each channel is a whole number from 0 to 255, where 0 is none of that color and 255 is full intensity.
Is hex case sensitive?
No. #FF5733 and #ff5733 are the same color. This tool outputs lowercase in the copy value.
What is rgb(255, 255, 255) in hex?
#ffffff, which is white. rgb(0, 0, 0) is #000000, black.