The complete ASCII (American Standard Code for Information Interchange) character set. ASCII uses 7 bits to represent 128 characters (0-127).
Control Characters (0-31, 127)
| Dec |
Hex |
Oct |
Char |
Name |
Description |
| 0 |
00 |
000 |
NUL |
Null |
Null character |
| 1 |
01 |
001 |
SOH |
Start of Heading |
Start of header |
| 2 |
02 |
002 |
STX |
Start of Text |
Start of text |
| 3 |
03 |
003 |
ETX |
End of Text |
End of text |
| 4 |
04 |
004 |
EOT |
End of Transmission |
End of transmission |
| 5 |
05 |
005 |
ENQ |
Enquiry |
Enquiry |
| 6 |
06 |
006 |
ACK |
Acknowledge |
Acknowledge |
| 7 |
07 |
007 |
BEL |
Bell |
Bell/alert |
| 8 |
08 |
010 |
BS |
Backspace |
Backspace |
| 9 |
09 |
011 |
HT |
Horizontal Tab |
Tab character |
| 10 |
0A |
012 |
LF |
Line Feed |
Newline |
| 11 |
0B |
013 |
VT |
Vertical Tab |
Vertical tab |
| 12 |
0C |
014 |
FF |
Form Feed |
Form feed/page break |
| 13 |
0D |
015 |
CR |
Carriage Return |
Carriage return |
| 14 |
0E |
016 |
SO |
Shift Out |
Shift out |
| 15 |
0F |
017 |
SI |
Shift In |
Shift in |
| 16 |
10 |
020 |
DLE |
Data Link Escape |
Data link escape |
| 17 |
11 |
021 |
DC1 |
Device Control 1 |
XON |
| 18 |
12 |
022 |
DC2 |
Device Control 2 |
|
| 19 |
13 |
023 |
DC3 |
Device Control 3 |
XOFF |
| 20 |
14 |
024 |
DC4 |
Device Control 4 |
|
| 21 |
15 |
025 |
NAK |
Negative Acknowledge |
|
| 22 |
16 |
026 |
SYN |
Synchronous Idle |
|
| 23 |
17 |
027 |
ETB |
End of Trans. Block |
|
| 24 |
18 |
030 |
CAN |
Cancel |
|
| 25 |
19 |
031 |
EM |
End of Medium |
|
| 26 |
1A |
032 |
SUB |
Substitute |
|
| 27 |
1B |
033 |
ESC |
Escape |
Escape character |
| 28 |
1C |
034 |
FS |
File Separator |
|
| 29 |
1D |
035 |
GS |
Group Separator |
|
| 30 |
1E |
036 |
RS |
Record Separator |
|
| 31 |
1F |
037 |
US |
Unit Separator |
|
| 127 |
7F |
177 |
DEL |
Delete |
Delete character |
Printable Characters (32-126)
Space and Punctuation (32-47)
| Dec |
Hex |
Char |
Name |
| 32 |
20 |
(space) |
Space |
| 33 |
21 |
! |
Exclamation mark |
| 34 |
22 |
" |
Quotation mark |
| 35 |
23 |
# |
Number sign / Hash |
| 36 |
24 |
$ |
Dollar sign |
| 37 |
25 |
% |
Percent sign |
| 38 |
26 |
& |
Ampersand |
| 39 |
27 |
' |
Apostrophe |
| 40 |
28 |
( |
Left parenthesis |
| 41 |
29 |
) |
Right parenthesis |
| 42 |
2A |
* |
Asterisk |
| 43 |
2B |
+ |
Plus sign |
| 44 |
2C |
, |
Comma |
| 45 |
2D |
- |
Hyphen-minus |
| 46 |
2E |
. |
Period / Full stop |
| 47 |
2F |
/ |
Slash / Solidus |
Digits (48-57)
| Dec |
Hex |
Char |
| 48 |
30 |
0 |
| 49 |
31 |
1 |
| 50 |
32 |
2 |
| 51 |
33 |
3 |
| 52 |
34 |
4 |
| 53 |
35 |
5 |
| 54 |
36 |
6 |
| 55 |
37 |
7 |
| 56 |
38 |
8 |
| 57 |
39 |
9 |
More Punctuation (58-64)
| Dec |
Hex |
Char |
Name |
| 58 |
3A |
: |
Colon |
| 59 |
3B |
; |
Semicolon |
| 60 |
3C |
< |
Less-than sign |
| 61 |
3D |
= |
Equals sign |
| 62 |
3E |
> |
Greater-than sign |
| 63 |
3F |
? |
Question mark |
| 64 |
40 |
@ |
At sign |
Uppercase Letters (65-90)
| Dec |
Hex |
Char |
|
Dec |
Hex |
Char |
|
Dec |
Hex |
Char |
| 65 |
41 |
A |
|
74 |
4A |
J |
|
83 |
53 |
S |
| 66 |
42 |
B |
|
75 |
4B |
K |
|
84 |
54 |
T |
| 67 |
43 |
C |
|
76 |
4C |
L |
|
85 |
55 |
U |
| 68 |
44 |
D |
|
77 |
4D |
M |
|
86 |
56 |
V |
| 69 |
45 |
E |
|
78 |
4E |
N |
|
87 |
57 |
W |
| 70 |
46 |
F |
|
79 |
4F |
O |
|
88 |
58 |
X |
| 71 |
47 |
G |
|
80 |
50 |
P |
|
89 |
59 |
Y |
| 72 |
48 |
H |
|
81 |
51 |
Q |
|
90 |
5A |
Z |
| 73 |
49 |
I |
|
82 |
52 |
R |
|
|
|
|
Brackets and Symbols (91-96)
| Dec |
Hex |
Char |
Name |
| 91 |
5B |
[ |
Left square bracket |
| 92 |
5C |
\ |
Backslash |
| 93 |
5D |
] |
Right square bracket |
| 94 |
5E |
^ |
Caret / Circumflex |
| 95 |
5F |
_ |
Underscore |
| 96 |
60 |
` |
Grave accent / Backtick |
Lowercase Letters (97-122)
| Dec |
Hex |
Char |
|
Dec |
Hex |
Char |
|
Dec |
Hex |
Char |
| 97 |
61 |
a |
|
106 |
6A |
j |
|
115 |
73 |
s |
| 98 |
62 |
b |
|
107 |
6B |
k |
|
116 |
74 |
t |
| 99 |
63 |
c |
|
108 |
6C |
l |
|
117 |
75 |
u |
| 100 |
64 |
d |
|
109 |
6D |
m |
|
118 |
76 |
v |
| 101 |
65 |
e |
|
110 |
6E |
n |
|
119 |
77 |
w |
| 102 |
66 |
f |
|
111 |
6F |
o |
|
120 |
78 |
x |
| 103 |
67 |
g |
|
112 |
70 |
p |
|
121 |
79 |
y |
| 104 |
68 |
h |
|
113 |
71 |
q |
|
122 |
7A |
z |
| 105 |
69 |
i |
|
114 |
72 |
r |
|
|
|
|
Remaining Symbols (123-126)
| Dec |
Hex |
Char |
Name |
| 123 |
7B |
{ |
Left curly bracket |
| 124 |
7C |
| |
Vertical bar / Pipe |
| 125 |
7D |
} |
Right curly bracket |
| 126 |
7E |
~ |
Tilde |
Quick Reference
Common Codes to Remember
| Character |
Decimal |
Hex |
Notes |
| Space |
32 |
20 |
First printable character |
| 0-9 |
48-57 |
30-39 |
Subtract 48 to get numeric value |
| A-Z |
65-90 |
41-5A |
Add 32 to get lowercase |
| a-z |
97-122 |
61-7A |
Subtract 32 to get uppercase |
| Newline (LF) |
10 |
0A |
Unix line ending |
| Carriage Return (CR) |
13 |
0D |
Windows uses CR+LF |
| Tab |
9 |
09 |
Horizontal tab |
| Null |
0 |
00 |
String terminator in C |
Case Conversion
To convert uppercase to lowercase: add 32 (or set bit 5)
'A' (65) + 32 = 'a' (97)
0x41 | 0x20 = 0x61
To convert lowercase to uppercase: subtract 32 (or clear bit 5)
'a' (97) - 32 = 'A' (65)
0x61 & 0xDF = 0x41
Character Type Checks
| Check |
Range |
| Is digit? |
48 ≤ c ≤ 57 |
| Is uppercase? |
65 ≤ c ≤ 90 |
| Is lowercase? |
97 ≤ c ≤ 122 |
| Is letter? |
(65 ≤ c ≤ 90) OR (97 ≤ c ≤ 122) |
| Is alphanumeric? |
Is digit OR is letter |
| Is printable? |
32 ≤ c ≤ 126 |
| Is control? |
c < 32 OR c = 127 |