HEX to RGB Converter
Convert between HEX and RGB color formats.
3-digit (#rgb), 6-digit (#rrggbb), 8-digit with alpha (#rrggbbaa)
Frequently Asked Questions
How do I convert HEX to RGB?
A HEX color like #FF5733 contains three pairs of hexadecimal digits: FF (red = 255), 57 (green = 87), and 33 (blue = 51). Each pair converts from base-16 to a decimal value between 0-255. The result is RGB(255, 87, 51). This tool handles the conversion instantly in both directions.
What is the difference between 3-digit and 6-digit HEX?
A 3-digit HEX code like #F53 is shorthand where each digit is doubled: #FF5533. Not all 6-digit colors have a 3-digit equivalent — only those where each pair consists of the same digit twice. The tool accepts both formats and always outputs the full 6-digit version for clarity.
Can I include alpha (transparency) values?
Yes — enter an 8-digit HEX code (e.g., #FF573380) or an RGBA value (e.g., rgba(255, 87, 51, 0.5)) and the tool converts between both formats. The alpha channel ranges from 00 (fully transparent) to FF (fully opaque) in HEX, or 0 to 1 in RGBA.
Which format should I use in CSS?
Both HEX and RGB are valid in all modern browsers. HEX is more compact (#FF5733 vs rgb(255, 87, 51)) and is the most popular choice for CSS. Use RGB when you need alpha transparency (RGBA) or when dynamically generating colors in JavaScript with variable red, green, blue values.
How do I find a color's HEX code?
Use our Color Picker to visually select a color and get its HEX code instantly. You can also right-click any element in your browser's developer tools to inspect its color value. Most design tools (Figma, Photoshop, Sketch) display HEX codes in their color panels.