Color · Converter
Hex to RGB converter.
Type a hex code and get red, green and blue values straight away. Edit the RGB side and the hex updates too. Shorthand like #F53 and alpha like #FF573380 both work.
Convert both ways
All formats
Enter a color to see every format.
How HEX to RGB works
The steps
- Drop the #. A hex color is a # followed by 3, 4, 6 or 8 hexadecimal digits (CSS Color 4, hex notation).
- Expand shorthand. With 3 or 4 digits each digit is doubled, so #F53 is #FF5533 and #F538 is #FF553388.
- Split into pairs. The first pair is red, the second green, the third blue, and an optional fourth pair is alpha.
- Read each pair as base 16. Multiply the first digit by 16 and add the second. FF is 15 × 16 + 15 = 255, 57 is 5 × 16 + 7 = 87 and 33 is 3 × 16 + 3 = 51.
- Alpha. The alpha pair divided by 255 is the opacity: 80 is 128, and 128 / 255 = 0.50.
So #FF5733 is rgb(255, 87, 51), and #FF573380 is rgba(255, 87, 51, 0.5).
Sources
- CSS Color Module Level 4, W3C Candidate Recommendation Draft (retrieved October 16, 2026).
Cite this page: TNAADO Tools, “Hex to RGB Converter,” tools.tnaado.ca/color/hex-to-rgb/, formulas from the W3C CSS Color specifications, retrieved October 16, 2026.
20 common colors
Click Use to load a row into the converter. The names are CSS color names; CMYK is the simple screen formula described above.
| Color | HEX | RGB | HSL | CMYK | Load |
|---|---|---|---|---|---|
| black | #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) | cmyk(0%, 0%, 0%, 100%) | |
| white | #FFFFFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) | cmyk(0%, 0%, 0%, 0%) | |
| red | #FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) | cmyk(0%, 100%, 100%, 0%) | |
| lime | #00FF00 | rgb(0, 255, 0) | hsl(120, 100%, 50%) | cmyk(100%, 0%, 100%, 0%) | |
| blue | #0000FF | rgb(0, 0, 255) | hsl(240, 100%, 50%) | cmyk(100%, 100%, 0%, 0%) | |
| yellow | #FFFF00 | rgb(255, 255, 0) | hsl(60, 100%, 50%) | cmyk(0%, 0%, 100%, 0%) | |
| cyan | #00FFFF | rgb(0, 255, 255) | hsl(180, 100%, 50%) | cmyk(100%, 0%, 0%, 0%) | |
| magenta | #FF00FF | rgb(255, 0, 255) | hsl(300, 100%, 50%) | cmyk(0%, 100%, 0%, 0%) | |
| gray | #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50%) | cmyk(0%, 0%, 0%, 50%) | |
| silver | #C0C0C0 | rgb(192, 192, 192) | hsl(0, 0%, 75%) | cmyk(0%, 0%, 0%, 25%) | |
| maroon | #800000 | rgb(128, 0, 0) | hsl(0, 100%, 25%) | cmyk(0%, 100%, 100%, 50%) | |
| olive | #808000 | rgb(128, 128, 0) | hsl(60, 100%, 25%) | cmyk(0%, 0%, 100%, 50%) | |
| green | #008000 | rgb(0, 128, 0) | hsl(120, 100%, 25%) | cmyk(100%, 0%, 100%, 50%) | |
| purple | #800080 | rgb(128, 0, 128) | hsl(300, 100%, 25%) | cmyk(0%, 100%, 0%, 50%) | |
| teal | #008080 | rgb(0, 128, 128) | hsl(180, 100%, 25%) | cmyk(100%, 0%, 0%, 50%) | |
| navy | #000080 | rgb(0, 0, 128) | hsl(240, 100%, 25%) | cmyk(100%, 100%, 0%, 50%) | |
| orange | #FFA500 | rgb(255, 165, 0) | hsl(39, 100%, 50%) | cmyk(0%, 35%, 100%, 0%) | |
| pink | #FFC0CB | rgb(255, 192, 203) | hsl(350, 100%, 88%) | cmyk(0%, 25%, 20%, 0%) | |
| brown | #A52A2A | rgb(165, 42, 42) | hsl(0, 59%, 41%) | cmyk(0%, 75%, 75%, 35%) | |
| gold | #FFD700 | rgb(255, 215, 0) | hsl(51, 100%, 50%) | cmyk(0%, 16%, 100%, 0%) |
Hex to RGB FAQ
How do I convert hex to RGB?
Split the six digits into three pairs and read each pair as a base 16 number. #FF5733 becomes FF = 255, 57 = 87 and 33 = 51, which is rgb(255, 87, 51). Paste a code into the box above and the tool does it for you, in either direction.
What does a 3 digit hex code like #F53 mean?
It is shorthand where each digit is doubled: #F53 means #FF5533. The CSS Color specification defines the 3 and 4 digit forms this way. Only colors whose pairs repeat (such as #FFAA00) have a shorthand.
What is an 8 digit hex code like #FF573380?
The last two digits are alpha, the opacity. 00 is fully transparent and FF is fully opaque. 80 is 128 out of 255, about 50% opaque, so #FF573380 is rgba(255, 87, 51, 0.5). A 4 digit code such as #F538 is the shorthand for the same thing.
Is hex uppercase or lowercase?
Either. The specification says the case of the letters does not matter, so #ff5733 and #FF5733 are the same color. This tool prints uppercase.
Why is my RGB result a whole number?
Each hex pair holds one of 256 values, 0 to 255, so the conversion is exact. Only the alpha value is rounded for display, to two decimals.
Is anything I type sent to a server?
No. The conversion runs in your browser and nothing is uploaded or stored.
What this does, and what it does not
This converts between written forms of sRGB colors, the color space browsers use for CSS by default. It does not convert to other color spaces such as Display P3 or Lab. Everything runs in your browser; nothing you type is sent anywhere.