Hex to RGB Converter
Type a hex color code to get its red, green and blue values: #FF6600 is rgb(255, 102, 0).
Runs in your browser. Nothing you enter is sent to a server. Sources: W3C CSS Color 4 Updated
RGB
rgb(255, 102, 0)
Red 255, green 102, blue 0. Full code #FF6600.
RGB to hex
Whole numbers from 0 to 255.
Hex
#FF6600
rgb(255, 102, 0)
How hex to RGB conversion works
A hex color code is three numbers written in base 16. In a 6-digit code the first pair of digits is red, the second is green and the third is blue. Each pair runs from 00 to FF, which is 0 to 255 in ordinary decimal numbers.
value = first digit × 16 + second digit (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15)
Base 16 is the same notation the text to hex converter uses for bytes: one pair of digits is one byte, 0 to 255. The tool accepts four lengths, as defined for CSS colors:
| Digits | Pattern | Example | Result |
|---|---|---|---|
| 6 | #RRGGBB | #FF6600 | rgb(255, 102, 0) |
| 3 | #RGB, each digit doubled | #F60 | rgb(255, 102, 0) |
| 8 | #RRGGBBAA, last pair is alpha | #FF660080 | rgba(255, 102, 0, 0.5) |
| 4 | #RGBA, each digit doubled | #F608 | rgba(255, 102, 0, 0.533) |
Anything else is not a hex color: a code with 5 or 7 digits, or one with letters after F, gives no result.
Hex to RGB example: #FF6600
Convert #FF6600.
- Red:
FF= 15 × 16 + 15 = 255 - Green:
66= 6 × 16 + 6 = 102 - Blue:
00= 0 × 16 + 0 = 0
The result is rgb(255, 102, 0), a strong orange.
To go the other way, divide each value by 16. The whole part is the first digit and the remainder is the second. 102 ÷ 16 is 6 remainder 6, so green is 66.
For print, a screen color is often matched to a Pantone ink. The hex to Pantone converter and the RGB to Pantone converter suggest the nearest entries from an unofficial table and show how far off each one is.
Alpha in 4- and 8-digit codes
The alpha pair sets how opaque the color is: 00 is fully transparent and FF is fully opaque. In rgba() alpha is written as a number from 0 to 1, so the tool divides the pair by 255. 80 is 128, and 128 ÷ 255 = 0.502, shown as 0.5. Alpha is rounded to two decimals when that still converts back to the same pair, and to three decimals when it does not.
Common CSS colors in hex and RGB
These are color names defined in CSS, with their hex codes and RGB values.
| Name | Hex | RGB |
|---|---|---|
| black | #000000 | rgb(0, 0, 0) |
| white | #FFFFFF | rgb(255, 255, 255) |
| gray | #808080 | rgb(128, 128, 128) |
| silver | #C0C0C0 | rgb(192, 192, 192) |
| red | #FF0000 | rgb(255, 0, 0) |
| maroon | #800000 | rgb(128, 0, 0) |
| orange | #FFA500 | rgb(255, 165, 0) |
| yellow | #FFFF00 | rgb(255, 255, 0) |
| lime | #00FF00 | rgb(0, 255, 0) |
| green | #008000 | rgb(0, 128, 0) |
| aqua | #00FFFF | rgb(0, 255, 255) |
| teal | #008080 | rgb(0, 128, 128) |
| blue | #0000FF | rgb(0, 0, 255) |
| navy | #000080 | rgb(0, 0, 128) |
| fuchsia | #FF00FF | rgb(255, 0, 255) |
| purple | #800080 | rgb(128, 0, 128) |
Hex to RGB Converter: FAQ
How do I convert hex to RGB by hand?
What does a 3-digit hex code mean?
What are 4-digit and 8-digit hex codes?
Does it matter whether the letters are upper or lower case?
Why does 80 as an alpha value show as 0.5?
Sources
- W3C CSS Color Module Level 4, section 5.2: the RGB hexadecimal notations (checked October 12, 2026)
- W3C CSS Color Module Level 4, section 6.1: named colors (checked October 12, 2026)