How to Convert Hexadecimal to ASCII

Author

CODINASION

Published on Jan 26, 2022

Converting hexadecimal to ASCII is a common task in computer programming. Hexadecimal is a base-16 number system that uses sixteen digits, 0 through 9 and A through F. Decimal is a base-10 number system that uses ten digits, 0 through 9. ASCII is a character encoding standard that assigns a unique number to each character. Converting hexadecimal to ASCII involves converting the hexadecimal number to decimal, and then looking up the ASCII character corresponding to each decimal value using an ASCII table.

Conversion

Here's a step-by-step guide on how to convert hexadecimal to ASCII:

  1. Choose the hexadecimal value you want to convert to ASCII.

  2. Convert the hexadecimal value to decimal using the following formula:

    decimal = (162×h1)+(161×h2)+(160×h3)+...+(16n×hn)(16^2 \times h1) + (16^1 \times h2) + (16^0 \times h3) + ... + (16^n \times hn)

    where h1, h2, h3, ..., hn are the hexadecimal digits and n is the number of digits in the hexadecimal value.

  3. Look up the ASCII character corresponding to each decimal value using an ASCII table.

Example

Let's walk through an example to illustrate the process. Suppose we want to convert the hexadecimal value 41 to ASCII.

  1. The hexadecimal value we want to convert is 41.

  2. We convert the hexadecimal value to decimal using the formula:

    decimal = (161×4)+(160×1)=65(16^1 \times 4) + (16^0 \times 1) = 65

  3. We look up the ASCII character corresponding to the decimal value using an ASCII table. The ASCII character corresponding to 65 is 'A'.

ASCII-Hexadecimal Table

Here's a table of the ASCII characters and their corresponding hexadecimal values:

CharacterDescriptionDecimalHexadecimal
0Zero4830
1One4931
2Two5032
3Three5133
4Four5234
5Five5335
6Six5436
7Seven5537
8Eight5638
9Nine5739
ACapital A6541
BCapital B6642
CCapital C6743
DCapital D6844
ECapital E6945
FCapital F7046
GCapital G7147
HCapital H7248
ICapital I7349
JCapital J744A
KCapital K754B
LCapital L764C
MCapital M774D
NCapital N784E
OCapital O794F
PCapital P8050
QCapital Q8151
RCapital R8252
SCapital S8353
TCapital T8454
UCapital U8555
VCapital V8656
WCapital W8757
XCapital X8858
YCapital Y8959
ZCapital Z905A
aSmall a9761
bSmall b9862
cSmall c9963
dSmall d10064
eSmall e10165
fSmall f10266
gSmall g10367
hSmall h10468
iSmall i10569
jSmall j1066A
kSmall k1076B
lSmall l1086C
mSmall m1096D
nSmall n1106E
oSmall o1116F
pSmall p11270
qSmall q11371
rSmall r11472
sSmall s11573
tSmall t11674
uSmall u11775
vSmall v11876
wSmall w11977
xSmall x12078
ySmall y12179
zSmall z1227A

See full ascii table here.

References

Heart with ribbonBecome a SponsorHeart with ribbon

Become a sponsor and help us maintain and improve this project. Every contribution counts. Thank you!