HEX to RGB converter
Turn a hex color code into RGB values.
Runs in your browser. Nothing you type is sent anywhere.
- 3, 4, 6 or 8 digits
- RGBA and HSL too
- One-click copy
How to convert HEX to RGB
- Type or paste a hex code, with or without the #.
- The RGB, RGBA and HSL values update as you type.
- Click the copy button next to the value you need.
HEX to RGB examples
| Hex | RGB | Note |
|---|---|---|
| #FF8800 | rgb(255, 136, 0) | Standard 6-digit hex |
| #F80 | rgb(255, 136, 0) | 3-digit shorthand, same color |
| #000000 | rgb(0, 0, 0) | Black |
| #FFFFFF | rgb(255, 255, 255) | White |
| #FF880080 | rgba(255, 136, 0, 0.5) | 8-digit hex with alpha |
A shorthand and its full-length version always decode to the exact same color, since each shorthand digit is simply doubled.
Where hex codes come from
Design tools like Figma and Photoshop, and every browser's DevTools, show a color as hex by default, since it is the shortest way to write an exact color as text.
Hex has been part of the web since HTML's earliest color attributes in the 1990s, long before the rgb() and hsl() CSS functions existed. That history is why hex is still the format most style guides lead with.
Common hex code mistakes
- A hex code needs 3, 4, 6 or 8 digits. A length of 5 or 7 is invalid and will not convert.
- Some older Windows APIs store colors as BGR instead of RGB, so a code copied from legacy code may have red and blue swapped.
- The last two digits of an 8-digit code are alpha, not a fourth color channel, so #FF880000 is fully transparent, not a darker orange.
HEX to RGB FAQ
How do I convert HEX to RGB by hand?
Split the code into three pairs and convert each pair from base 16 to base 10. For #F08A3C that gives F0 = 240, 8A = 138 and 3C = 60, so rgb(240, 138, 60).
What is a 3-digit hex code?
A shorthand where each digit is doubled. #F80 is the same color as #FF8800, and #000 is black.
What do the last two digits of an 8-digit hex code mean?
They are the alpha, or opacity. #FF880080 is orange at about 50 percent opacity, the same as rgba(255, 136, 0, 0.5).
Does the code need a # at the start?
No. The converter accepts codes with or without the #, in upper or lower case.
Why does my hex code show as invalid?
A hex code must be exactly 3, 4, 6 or 8 digits using 0-9 and A-F. A length like 5 or 7, or a character outside that range, will not convert.
Can I paste a CSS variable like var(--brand)?
No, paste the literal color value. Look up what the variable resolves to first, for example in your browser's DevTools computed styles panel.
What is the shortest possible hex code?
3 digits, such as #000 for black or #fff for white. Each digit stands for a doubled pair in the full 6-digit value.