Skip to content

Computer Science · Ch 2 — Encoding Schemes and Number System

American Standard Code for Information Interchange (ASCII)

2.1.1

American Standard Code for Information Interchange (ASCII)

In the early 1960s, computers could not communicate with one another: each machine represented the keys of its keyboard in its own way, so text produced on one computer meant nothing to another. The need for a common standard was recognised, and the encoding scheme ASCII — American Standard Code for Information Interchange — was developed to standardise how characters are represented. ASCII remains the most commonly used coding scheme even today.

Why 7-bit ASCII can encode exactly 128 characters

Initially, ASCII used 7 bits to represent each character. Since a binary digit can take only 2 values (0 or 1), a string of 7 bits can form:

2^7 = 128 distinct patterns

So 7-bit ASCII can encode 128 different characters — enough for every key on an English keyboard: uppercase and lowercase letters, digits, punctuation marks and control characters.

Limitation: ASCII can encode the character set of the English language only. Other scripts (such as Indian languages) have no place in the 128 codes — this is precisely the gap that ISCII and UNICODE (next sections) were created to fill.

A sample of printable ASCII codes

Some printable characters and their decimal code values (from the ASCII table):

CharacterDecimalCharacterDecimalCharacterDecimal
Space32@64` (backtick)96
!33A65a97
"34B66b98
#35C67c99
dollar sign36D68d100
%37E69e101
&38F70f102
'39G71g103
(40H72h104
)41I73i105

Notice the pattern: uppercase letters start at 65 (A) and run consecutively; lowercase letters start at 97 (a). Uppercase and lowercase versions of the same letter have different codes — the computer treats 'A' (65) and 'a' (97) as different characters.

Worked example — encoding a whole word (Example 2.2)

Task: encode the word DATA and convert the encoded values into binary, the form a computer understands.

Look up each letter's ASCII value, then write each value as a 7-bit binary code:

  • D → ASCII 68 → 7-bit binary 1000100
  • A → ASCII 65 → 7-bit binary 1000001
  • T → ASCII 84 → 7-bit binary 1010100
  • A → ASCII 65 → 7-bit binary 1000001

Replacing every letter with its code gives the word's ASCII form and its binary form:

DATA
ASCII code68658465
Binary code1000100100000110101001000001

So the text "DATA" travels through the computer as the bit stream 1000100 1000001 1010100 1000001.

You can verify these codes yourself in Python:

for ch in "DATA": …
Table 2.1ASCII code for some printable characters
CharacterDecimal ValueCharacterDecimal ValueCharacterDecimal Value
Space32@64`96
!33A65a97
“34B66b98
#35C67c99
Table 2.2ASCII and Binary values for word DATA
DATA
ASCII Code68658465