How to convert RGB to HEX
- Enter the red, green and blue values, each from 0 to 255.
- Click Convert.
- Copy the HEX code from the result. The color preview shows the exact color.
How the conversion works
A HEX color is the three RGB numbers written in base 16, two digits each. Convert each channel to hexadecimal and join them after a # sign.
Example: rgb(255, 87, 51). 255 is FF, 87 is 57 and 51 is 33, so the HEX code is #FF5733.
Tips
- A channel value of 0 becomes 00 and 255 becomes FF.
- Values outside 0 to 255 are limited to that range.
- When both digits of each pair match (like #FFAA00), CSS lets you shorten the code to #FA0.
Frequently Asked Questions
Is the HEX code case sensitive?
No. #ff5733 and #FF5733 are the same color.
What is the HEX code for rgb(0, 0, 0)?
#000000, which is black. White, rgb(255, 255, 255), is #FFFFFF.
Can I convert decimals like 127.5?
Use whole numbers. Decimal values are rounded.
More Color Converters