Programming can be fun, so can cryptography; however they should not be combined. --Kreitzberg and Shneiderman

Hexadecimal (Hex) to Decimal Lookup Table

Easily convert hex to decimal and back again with this convenient table

By steve on January 07, 2007.
Updated on January 12, 2013.
Viewed 415,196 times (111 times today).
DeveloperTools and TablesMath

Summary

QUESTION: How do I easily convert hexadecimal numbers to decimal numbers and vice versa in a simple lookup table.

The table immediately follows, but see page 2 for the C# code that generated the table.

Hex To Decimal Lookup Table

D: 0-15
X: 0-F
DecHex
00
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F
D: 16-31
X: 10-1F
DecHex
1610
1711
1812
1913
2014
2115
2216
2317
2418
2519
261A
271B
281C
291D
301E
311F
D: 32-47
X: 20-2F
DecHex
3220
3321
3422
3523
3624
3725
3826
3927
4028
4129
422A
432B
442C
452D
462E
472F
D: 48-63
X: 30-3F
DecHex
4830
4931
5032
5133
5234
5335
5436
5537
5638
5739
583A
593B
603C
613D
623E
633F
D: 64-79
X: 40-4F
DecHex
6440
6541
6642
6743
6844
6945
7046
7147
7248
7349
744A
754B
764C
774D
784E
794F
D: 80-95
X: 50-5F
DecHex
8050
8151
8252
8353
8454
8555
8656
8757
8858
8959
905A
915B
925C
935D
945E
955F
D: 96-111
X: 60-6F
DecHex
9660
9761
9862
9963
10064
10165
10266
10367
10468
10569
1066A
1076B
1086C
1096D
1106E
1116F
D: 112-127
X: 70-7F
DecHex
11270
11371
11472
11573
11674
11775
11876
11977
12078
12179
1227A
1237B
1247C
1257D
1267E
1277F
D: 128-143
X: 80-8F
DecHex
12880
12981
13082
13183
13284
13385
13486
13587
13688
13789
1388A
1398B
1408C
1418D
1428E
1438F
D: 144-159
X: 90-9F
DecHex
14490
14591
14692
14793
14894
14995
15096
15197
15298
15399
1549A
1559B
1569C
1579D
1589E
1599F
D: 160-175
X: A0-AF
DecHex
160A0
161A1
162A2
163A3
164A4
165A5
166A6
167A7
168A8
169A9
170AA
171AB
172AC
173AD
174AE
175AF
D: 176-191
X: B0-BF
DecHex
176B0
177B1
178B2
179B3
180B4
181B5
182B6
183B7
184B8
185B9
186BA
187BB
188BC
189BD
190BE
191BF
D: 192-207
X: C0-CF
DecHex
192C0
193C1
194C2
195C3
196C4
197C5
198C6
199C7
200C8
201C9
202CA
203CB
204CC
205CD
206CE
207CF
D: 208-223
X: D0-DF
DecHex
208D0
209D1
210D2
211D3
212D4
213D5
214D6
215D7
216D8
217D9
218DA
219DB
220DC
221DD
222DE
223DF
D: 224-239
X: E0-EF
DecHex
224E0
225E1
226E2
227E3
228E4
229E5
230E6
231E7
232E8
233E9
234EA
235EB
236EC
237ED
238EE
239EF
D: 240-255
X: F0-FF
DecHex
240F0
241F1
242F2
243F3
244F4
245F5
246F6
247F7
248F8
249F9
250FA
251FB
252FC
253FD
254FE
255FF

Why I Programmed a Hex to Dec Lookup Table?

So I'm sitting at my computer developing a website. I'm tweaking the colors trying to get 'em right. I try burlywood, cornflowerblue, saddlebrown and a few others. But I need more subtlety than the standard named colors. One of my graphics applications has a color picker eye-dropper so I decide to pull some colors off of one of the images.

Unfortunately, that application only gives me the decimal RGB values for the color. But I need a hex value to put in my stylesheet. So I go to Start->Programs->Accessories->Calculator and start typing in decimal numbers between 0 and 255 to determine their hex value. But I have 8 colors which amounts to 24 numbers I need to convert. This is going to take forever!

So I decided I needed a convenient lookup table. It wouldn't be fast exactly, but it would certainly speed things up. So I wrote a little program in C# to generate the table. And there it is above.

If you're interested in the C# method that generates the table, click to the next page.

Back to Top
comments powered by Disqus
Welcome to my blog about software development and the Microsoft stack.

I've been a full time .NET developer for ten years, but I didn't start my professional life as a programmer ... more

Subscribe to my email newsletter for news, updates and more!

Sign Up!

Share/Print this page: