What Is a HEX Colour Code?
A HEX colour code is a six-digit hexadecimal number that describes a colour on screens, websites and in design software. It is written with a hash sign, such as #1E90FF, and made of three pairs of digits: the first pair is red, the second green and the third blue. Each pair ranges from 00 (none of that colour) to FF (full intensity), which is 0 to 255 in ordinary decimal numbers. Mixing different amounts of red, green and blue light produces over 16.7 million possible colours (256 × 256 × 256).
RGB describes exactly the same colour using decimal numbers: rgb(30, 144, 255). HEX is compact and common in HTML, CSS, brand guidelines and design tools like Figma and Photoshop. RGB is easier to read, needed for transparency with rgba(), and required by many programming APIs, game engines and spreadsheets. This HEX to RGB converter translates between the two instantly, along with every other common colour format.
How to Convert HEX to RGB
- Type or paste a hex code into the box, with or without the #. Three-digit shorthand (#F80) and eight-digit hex with transparency (#1E90FF80) both work. You can also use the colour picker.
- Read the RGB value at the top of the list, along with RGBA, HSL, HSV, CMYK and developer formats.
- Click Copy next to any format to copy it to your clipboard.
- Open "How the conversion works" to see each pair converted from hexadecimal to decimal.
The Math: Converting Hex to Decimal by Hand
Hexadecimal is base 16. The digits 0–9 keep their values, and the letters A–F stand for 10–15. Each two-digit pair equals first digit × 16 + second digit. For #1E90FF:
- Red 1E = 1 × 16 + 14 = 30
- Green 90 = 9 × 16 + 0 = 144
- Blue FF = 15 × 16 + 15 = 255
So #1E90FF = rgb(30, 144, 255), a bright "dodger blue". Going the other way, divide each RGB value by 16: the whole number is the first hex digit, and the remainder is the second. 200 ÷ 16 = 12 remainder 8, so 200 = C8.
Shorthand and 8-Digit Hex Codes
| Format | Example | Expands to | RGB(A) |
|---|---|---|---|
| 3-digit shorthand | #F80 | #FF8800 | rgb(255, 136, 0) |
| 6-digit | #1E90FF | — | rgb(30, 144, 255) |
| 4-digit with alpha | #F808 | #FF880088 | rgba(255, 136, 0, 0.533) |
| 8-digit with alpha | #1E90FF80 | — | rgba(30, 144, 255, 0.502) |
In shorthand, each digit is doubled: #ABC means #AABBCC. The extra pair in 8-digit hex is the alpha channel (opacity), where 00 is fully transparent and FF is fully opaque. All modern browsers support 8-digit hex in CSS. Note that Android writes alpha first (#AARRGGBB), which is why the Android format is shown separately.
Common Colours: HEX and RGB
| Colour | HEX | RGB |
|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Lime green | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Grey | #808080 | rgb(128, 128, 128) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Purple | #800080 | rgb(128, 0, 128) |
Other Formats Explained
- RGBA: RGB plus an alpha value from 0 (transparent) to 1 (opaque), used in CSS.
- HSL: hue, saturation and lightness, which makes it easy to create lighter or darker variants.
- CMYK: cyan, magenta, yellow and black percentages for print. The values are approximate, because real print colour depends on the ink and paper profile.
- Float: each channel from 0 to 1, as used in OpenGL/GLSL shaders, Unity and Three.js.
- Integer: the whole colour as one decimal number (R × 65536 + G × 256 + B), used in some APIs, Discord embeds and databases.
Features
- Every hex format3, 4, 6 and 8 digits, with or without #.
- 12 output formatsRGB, RGBA, HSL, HSV, CMYK, float, Swift and more.
- Step-by-stepEach hex pair converted to decimal.
- RGB to HEXSliders for the reverse conversion.
- Bulk converterConvert whole lists at once.
- Colour nameClosest CSS named colour, by perceptual distance.
Frequently Asked Questions
Is HEX the same as RGB?
Yes. They describe the same colour in different number systems: hex is base 16, and RGB uses base-10 numbers from 0 to 255.
Are hex codes case-sensitive?
No. #ff8800 and #FF8800 are identical.
What is #000000 in RGB?
rgb(0, 0, 0), which is black. #FFFFFF is rgb(255, 255, 255), white.
How do I add transparency to a hex colour?
Append two hex digits for the alpha: 80 is about 50%, CC about 80%, and 33 about 20%. The Opacity Calculator lists every value.
Why does my colour look different in print?
Screens mix light (RGB), while printers mix ink (CMYK). Some bright screen colours can't be printed exactly, so ask your printer for their CMYK profile.