Introduction to ASCII

(American Standard Code for Information Interchange)

Coded messages have been used for many years. Sometimes spies would scramble the letters in a message or use numbers to represent the letters of the alphabet. Morse Code was invented to send messages across the telegraph line by using a series of short and long pulses. Codes such as ASCII were developed to represent characters as groups of ones and zeros. Ones and zeros can be used easily by computers and communication equipment. The most popular codes for computers are ASCII and EBCDIC (Extended Binary Coded Decimal Interchange Code). The EBCDIC code set is used on large IBM mainframe computers, while ASCII is used almost everywhere else.

Each character is assigned a numeric value. The value can be expressed in decimal for BASIC programs, or in octal or hexadecimal for most other programs. The first 32 codes are used as control characters. These can be used to ring the bell (BEL), move the paper up one line (LF), backspace (BS), indicate the start or end of text (STX, ETX) etc. ASCII uses only seven bits, giving 128 combinations. Several computer manufactures use all eight bits giving 256 printable characters. These extra codes are called "Extended-ASCII" and are not uniformly defined from one manufacture to the next.

The ASCII character set is fine for characters used in English. ASCII does not have the ability to display characters with accents or characters in other languages such as Greek, Hebrew, Japanese, Chinese, Arabic, Korean, Thai and many others. Unicode extends ASCII and uses 16 or more bits and includes almost every character or glyph used in the world.

American Standard Code for Information Interchange - ASCII

^A indicates Ctrl+A,   ^B indicates Ctrl+B,   ^C indicates Ctrl+C, etc.
 DEC HEX CHAR CODE DESCRIPTION  DEC OCT HEX CHAR  DEC OCT HEX CHAR   DEC OCT HEX CHAR
  0  00  ^@  NUL Null
  1  01  ^A  SOH Start of Header
  2  02  ^B  STX Start of Text
  3  03  ^C  ETX End of Text
  4  04  ^D  EOT End Transmission
  5  05  ^E  ENQ Enquiry
  6  06  ^F  ACK Acknowledge
  7  07  ^G  BEL Bell
  8  08  ^H  BS  Backspace
  9  09  ^I  TAB Tab
 10  0A  ^J  LF  NewLine
 11  0B  ^K  HT  VertTab
 12  0C  ^L  FF  FormFeed
 13  0D  ^M  CR  Return
 14  0E  ^N  SO  Shift Out
 15  0F  ^O  SI  Shift In
 16  10  ^P  DEL Delete
 17  11  ^Q  DC1 Device Ctrl 1
 18  12  ^R  DC2 Device Ctrl 2
 19  13  ^S  DC3 Device Ctrl 3
 20  14  ^T  DC4 Device Ctrl 4
 21  15  ^U  NAK NegativeAck
 22  16  ^V  SYN Sync
 23  17  ^W  ETB End Xmit Block
 24  18  ^X  CAN Cancel
 25  19  ^Y  EM  End Message
 26  1A  ^Z  SUB Substitute
 27  1B  ^[  ESC Escape
 28  1C  ^\  FS  Field Separator
 29  1D  ^]  GS  Group Separator
 30  1E  ^^  RS  Record Separator
 31  1F  ^_  US  Unit Separator
 32  040  20 space
 33  041  21   !
 34  042  22   "
 35  043  23   #
 36  044  24   $
 37  045  25   %
 38  046  26   &
 39  047  27   '
 40  050  28   (
 41  051  29   )
 42  052  2A   *
 43  053  2B   +
 44  054  2C   ,
 45  055  2D   -
 46  056  2E   .
 47  057  2F   /
 48  060  30   0
 49  061  31   1
 50  062  32   2
 51  063  33   3
 52  064  34   4
 53  065  35   5
 54  066  36   6
 55  067  37   7
 56  070  38   8
 57  071  39   9
 58  072  3A   :
 59  073  3B   ;
 60  074  3C   <
 61  075  3D   =
 62  076  3E   >
 63  077  3F   ?
 64  100  40   @
 65  101  41   A
 66  102  42   B
 67  103  43   C
 68  104  44   D
 69  105  45   E
 70  106  46   F
 71  107  47   G
 72  110  48   H
 73  111  49   I
 74  112  4A   J
 75  113  4B   K
 76  114  4C   L
 77  115  4D   M
 78  116  4E   N
 79  117  4F   O
 80  120  50   P
 81  121  51   Q
 82  122  52   R
 83  123  53   S
 84  124  54   T
 85  125  55   U
 86  126  56   V
 87  127  57   W
 88  130  58   X
 89  131  59   Y
 90  132  5A   Z
 91  133  5B   [
 92  134  5C   \
 93  135  5D   ]
 94  136  5E   ^
 95  137  5F   _
  96  140  60   `
  97  141  61   a
  98  142  62   b
  99  143  63   c
 100  144  64   d
 101  145  65   e
 102  146  66   f
 103  147  67   g
 104  150  68   h
 105  151  69   i
 106  152  6A   j
 107  153  6B   k
 108  154  6C   l
 109  155  6D   m
 110  156  6E   n
 111  157  6F   o
 112  160  70   p
 113  161  71   q
 114  162  72   r
 115  163  73   s
 116  164  74   t
 117  165  75   u
 118  166  76   v
 119  167  77   w
 120  170  78   x
 121  171  79   y
 122  172  7A   z
 123  173  7B   {
 124  174  7C   |
 125  175  7D   }
 126  176  7E   ~
 127  177  7F   DEL
    Each hex digit represents 4 bits
HEX Binary
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1101
1100
1101
1110
1111

Examples:
'S' is 0x53 or binary 01010011
'e' is 0x65 or binary 01100101

You should memorize the codes for Backspace, Tab, NewLine, Return and Escape.
DOS/Windows uses the ^D (hex 04) and Unix uses ^Z (hex 1A) to indicate the end of a text file.