← CS Unplugged

CS Unplugged activity

Secret Messages in ASCII

CS Unplugged activity slides Lesson plan (and sub notes)

About 20 minutesSoloPencil

Computers do not store letters. They store numbers. ASCII is the code that turns each letter into a number, and you are about to crack it.

Your code table

ABCDEFGHI
656667686970717273
JKLMNOPQR
747576777879808182
STUVWXYZspace
838485868788899032

What to do

  1. Find each number in the table above.
  2. Write the matching letter in the box under it.
  3. A hatched box is the code 32. That means “space.” Leave it blank.
  4. Read your finished answer to check it makes sense.

Now decode these

1. A computer stores every letter as a ___.

78
85
77
66
69
82

2. Binary only uses two digits: zero and ___.

79
78
69

3. A group of eight bits is called a ___.

66
89
84
69

4. Fun fact: the first computer bug was a real ___.

84
73
78
89
32
77
79
84
72

Lowercase, punctuation, and digits

Real messages need more than capital letters. Every lowercase letter’s code is 32 more than its capital: A is 65, so a is 97.

abcdefghi
979899100101102103104105
jklmnopqr
106107108109110111112113114
stuvwxyz
115116117118119120121122
space!,.?
3233444663
0123456789
48495051525354555657

Notice that the digit 7 is stored as 55, not 7. To a computer, the character “7” and the number 7 are different things. (That’s why a program that reads typed text has to convert “12” into the number 12 before it can do math with it.)

For example, 72 105 33 is Hi!

Decode this friendly question.

72
105
44
32
104
111
119
32
97
114
101
32
121
111
117
63

Now with digits. Decode this one.

73
32
97
109
32
49
50
32
121
101
97
114
115
32
111
108
100
46

Write your name in ASCII

Now go the other way. Write one letter of your name in each top box, then use the table to write its code underneath.

Short name? Leave the extra boxes blank. Longer than eight letters? Keep going on the back of the page.

Secret messages for a friend

Think of two short messages (up to 16 letters, spaces, and marks each) and write them on the lines below the fold line. Then write each message’s codes in its boxes, one character per box. Fold the bottom strip under so only the codes show, and trade with a friend. Can they read your messages?

Message 1 codes:

Message 2 codes:

fold here

Message 1:

Message 2:

Your friend’s messages

Decode your friend’s codes, one character in each box.

Friend's message 1:

Friend's message 2:

ASCII table: 32 to 122

Every character from code 32 to 122. Use it for your secret messages.

CodeCharCodeCharCodeCharCodeCharCodeChar
32space51370F89Y108l
33!52471G90Z109m
34"53572H91[110n
35#54673I92\111o
36$55774J93]112p
37%56875K94^113q
38&57976L95_114r
39'58:77M96`115s
40(59;78N97a116t
41)60<79O98b117u
42*61=80P99c118v
43+62>81Q100d119w
44,63?82R101e120x
45-64@83S102f121y
46.65A84T103g122z
47/66B85U104h
48067C86V105i
49168D87W106j
50269E88X107k

Want even more (codes 0 to 127, in hex too)? See the full ASCII / Hex table.

Answer key

  1. NUMBER
  2. ONE
  3. BYTE
  4. TINY MOTH

Lowercase, punctuation, and digits: Hi, how are you? / I am 12 years old.