RGB Colors in Decimal and Hexadecimal Values

Explore using Hexadecimal values to express RGB colors.

While we learned the basics about RGB colors, that constitute portions of Red, Blue, and Green—what we need to know is that there is so much more to learn about them. Did you know that there are two ways in which individual RGB color values are expressed? The most common way is using decimals, and that’s something we already explored in our Color Models: RGB page.

But have you run into color values such as FF0000 or 006699? These six-digit values that combine number and alphabet characters are hexadecimal. Now hexadecimals express the same values as decimals—but unlike decimals that need 9 characters to describe the three colors, R, G, and B, hexadecimals need only 6 characters. Let’s understand this concept better.

We all know that the decimal system uses 10 number characters from 0 to 9. Using these 10 numerical characters, the largest numbers can be expressed in a way that the human mind can easily understand. But what if there were 16 numerical characters rather than 10? Well, there’s already a numerical value system in place called the hexadecimal system, which is often shortened and called the hex system. This system uses the ten decimal numerical characters from 0 to 9, and then it also uses the first 6 alphabet characters, A to F. This means that while numbers 0 to 9 are similar in both decimal and hexadecimal systems, the next 6 numbers are unique to the latter system. Look at this table:

0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

What does this mean for your RGB colors? Each R, G, and B value can possess one of 256 numbers, from 0 to 255. In hexadecimal terms, 0 to 255 will show up as 00 to FF. That’s because one hexadecimal digit can possess 16 different values (which correspond to 0 to 15 in decimals). Also, as you may have realized, two hexadecimal digits together, often called a byte, can constitute 16×16, that results in 256 different values of color. Incidentally, that’s exactly what the RGB system needs!

Let’s now play with these hexadecimal digits to represent RGB colors. To begin with, we will start with pure Red, which has an RGB value of 255,0,0. In hexadecimal digits, this same Red would be FF0000 because 255 equates to FF, and 0 equates to 00.

In the following table, you can find both decimal and hexadecimal digits that represent popular colors:

Color
Red 255, 0, 0 FF0000
Green 0, 255, 0 00FF00
Blue 0, 0, 255 0000FF
Yellow 255, 255, 0 FFFF00
Cyan 0, 255, 255 00FFFF
Magenta 255, 0, 255 FF00FF
Orange 255, 125, 0 FF7D00
Yellow-Green 125, 255, 0 7DFF00
Cyan-Green 0, 255, 125 00FF7D
Cyan-Blue 0, 125, 255 007DFF
Blue-Magenta 125, 0, 255 7D00FF
Red-Magenta 255, 0, 125 FF007D

Here are hexadecimal (H columns) equivalents of all decimal (D columns) values that you will need to represent RGB colors.

D H D H D H D H
0 00 64 40 128 80 192 C0
1 01 65 41 129 81 193 C1
2 02 66 42 130 82 194 C2
3 03 67 43 131 83 195 C3
4 04 68 44 132 84 196 C4
5 05 69 45 133 85 197 C5
6 06 70 43 134 86 198 C6
7 07 71 47 135 87 199 C7
8 08 72 48 136 88 200 C8
9 09 73 49 137 89 201 C9
10 0A 74 4A 138 8A 202 CA
11 0B 75 4B 139 8B 203 CB
12 0C 76 4C 140 8C 204 CC
13 0D 77 4D 141 8D 205 CD
14 0E 78 4E 142 8E 206 CE
15 0F 79 4F 143 8F 207 CF
16 10 80 50 144 90 208 D0
17 11 81 51 145 91 209 D1
18 12 82 52 146 92 210 D2
19 13 83 53 147 93 211 D3
20 14 84 54 148 94 212 D4
21 15 85 55 149 95 213 D5
22 16 86 56 150 96 214 D6
23 17 87 57 151 97 215 D7
24 18 88 58 152 98 216 D8
25 19 89 59 153 99 217 D9
26 1A 90 5A 154 9A 218 DA
27 1B 91 5B 155 9B 219 DB
28 1C 92 5C 156 9C 220 DC
29 1D 93 5D 157 9D 221 DD
30 1E 94 5E 158 9E 222 DE
31 1F 95 5F 159 9F 223 DF
32 20 96 60 160 A0 224 E0
33 21 97 61 161 A1 225 E1
34 22 98 62 162 A2 226 E2
35 23 99 63 163 A3 227 E3
36 24 100 64 164 A4 228 E4
37 25 101 65 165 A5 229 E5
38 26 102 66 166 A6 230 E6
39 27 103 67 167 A7 231 E7
40 28 104 68 168 A8 232 E8
41 29 105 69 169 A9 233 E9
42 2A 106 6A 170 AA 234 EA
43 2B 107 6B 171 AB 235 EB
44 2C 108 6C 172 AC 236 EC
45 2D 109 6D 173 AD 237 ED
46 2E 110 6E 174 AE 238 EE
47 2F 111 6F 175 AF 239 EF
48 30 112 70 176 B0 240 F0
49 31 113 71 177 B1 241 F1
50 32 114 72 178 B2 242 F2
51 33 115 73 179 B3 243 F3
52 34 116 74 180 B4 244 F4
53 35 117 75 181 B5 245 F5
54 36 118 76 182 B6 246 F6
55 37 119 77 183 B7 247 F7
56 38 120 78 184 B8 248 F8
57 39 121 79 185 B9 249 F9
58 3A 122 7A 186 BA 250 FA
59 3B 123 7B 187 BB 251 FB
60 3C 124 7C 188 BC 252 FC
61 3D 125 7D 189 BD 253 FD
62 3E 126 7E 190 BE 254 FE
63 3F 127 7F 191 BF 255 FF