Pick & Convert
RGB to HEX Converter
Enter red, green and blue values from 0 to 255 to get the matching HEX code. For example, rgb(34, 139, 34) is #228B22.
Your colors and images stay in your browser. Nothing is uploaded or stored on our servers.
How to use the RGB to HEX Converter
- Type the red, green and blue numbers in the three fields. Each one must be between 0 and 255.
- The HEX code appears at the top, in uppercase with a leading #.
- Press Copy HEX to use it in CSS, design tools or documentation.
- Scroll the table for HSL, CMYK and the other formats of the same color.
Examples
Digit by digit
Each channel becomes two base-16 digits: 34 is 22, 139 is 8B and 34 is 22, so rgb(34, 139, 34) is #228B22.
The extremes
rgb(0, 0, 0) is #000000 (black) and rgb(255, 255, 255) is #FFFFFF (white). Equal channels always give a gray.
Decimals
If your source gives fractions such as 64.6, the tool rounds to the nearest whole number before converting.
Tips
- Use the Tab key to move between the red, green and blue fields; the result updates as you type.
- Out-of-range numbers are rejected with a message instead of being silently clipped.
Questions about the RGB to HEX Converter
How do I convert RGB to HEX?
Convert each of the three numbers to base 16 and write them side by side, adding a leading zero when a number gives only one digit. For example 7 becomes 07 and 255 becomes FF.
What range do RGB values use?
Each channel runs from 0 to 255, which is 256 levels. Three channels describe 16,777,216 colors.
Why does a HEX code contain letters?
HEX is base 16, which needs sixteen symbols: the digits 0 to 9 and the letters A to F for the values 10 to 15.
Can I paste an rgb() string with percentages?
The three-field form takes whole numbers. To convert a pasted rgb() string, including percentages, use the color converter.
Related tools
HEX to RGB Converter
Turn a HEX color code into RGB values.
Color Converter
Convert between HEX, RGB, HSL, HSV, HWB and CMYK instantly.
RGB to HSL Converter
Turn RGB values into hue, saturation and lightness.
Color Picker
Pick any color and copy its HEX, RGB, HSL and CMYK values.
Want the background? Read RGB Colors Explained.