RGB to HEX
Runs locally
Type RGB values such as rgb(51, 102, 153), or just 51, 102, 153, and get the HEX code straight away, ready to copy. rgba() colors with transparency become 8-digit HEX codes.
- Free to use
- No registration
- Runs locally in your browser
- Your data is never uploaded
#336699rgb(51, 102, 153)hsl(210, 50%, 40%)hsv(210, 67%, 60%)Contrast (WCAG)
White text: 6.00:1
AA pass · AAA fail · AA large text pass
Black text: 3.50:1
AA fail · AAA fail · AA large text pass
Tints and shades
Palettes
Click a swatch to copy its HEX value.
Your data is processed locally in your browser and is not uploaded.
Learn more about this tool⌄
How it works
Each of the three RGB numbers (0 to 255) is written as two hexadecimal digits and the pairs are joined: 51 is 33, 102 is 66 and 153 is 99, so rgb(51, 102, 153) is #336699. If the color has an alpha value it becomes a fourth pair, for example 0.5 is 80.
Common use cases
- Turning RGB values from an image editor into a HEX code for CSS or HTML
- Getting a compact color code to share with a designer or developer
- Converting an rgba() color to 8-digit HEX
Frequently asked questions
- How do I convert RGB to HEX by hand?
- Convert each number to two hexadecimal digits and join them. For rgb(255, 136, 0): 255 = FF, 136 = 88, 0 = 00, so #FF8800.
- Do I need to type rgb( )?
- No. Three numbers separated by commas or spaces are read as red, green and blue.
- Are HEX codes case sensitive?
- No. #ff8800 and #FF8800 are the same color.