Codes for letters using binary representation for junior students

  • Duration: 45 minutes
  • Ages 5 to 7: Lesson 3

Learning outcomes

Students will be able to:

  • Match letters in the alphabet to the numbers representing them.
    Computational Thinking: Abstraction Literacy
  • Count on from the highest number to find the total number of dots on the binary cards.
    Computational Thinking: Decomposition Mathematics: Numeracy
  • Count on from the highest number to find the total number of dots on the binary cards.
    Computational Thinking: Decomposition Mathematics: Numeracy
  • Recognise that the alphabet is in an order and so are numbers.
    Mathematics: Numeracy
  • Match letters in the alphabet to the numbers representing them.
    Computational Thinking: Abstraction Literacy

Key questions

How do you think a computer knows which letter to show on the screen?

Teaching observations

Discussion may start at the 26 letters of the English alphabet, and then expand to other characters on the keyboard, including capital letters, digits and punctuation. Students may be aware that other languages can have thousands of characters, and the range of characters is also expanding as emoticons are invented!

Lesson starter

Notes on resources

There is also an online interactive version of the binary cards here, from the Computer Science Field Guide, but it is preferable to work with physical cards.

Can we match letters to numbers so that we can send coded messages to each other?

How many letters are there in the alphabet? Let’s count them together on our alphabet cards.

How can we represent the letters using numbers? (Guide students to the idea of using 1 for A, 2 for B, and so on.)

We can represent numbers using binary, but in the last lesson with 4 bits, what was the biggest number we could represent? (15)

How can we represent bigger numbers? (Add a card). How many dots on the extra card? (16)

Give out the cards, and have the students place them on the table in the correct order (16, 8, 4, 2, 1).

Now give them a number by saying "No, Yes, No, No, No" for the 5 cards. Ask them how many dots this produces. (The "Yes" is for the 8 card, so it's the number 8.) Which letter is number 8? ("H"). This can be written on the board.

Now give the next number, "No, Yes, No, No, Yes" (9). Which letter is number 9? ("I", which can be written after the "H".)

That's the whole message - "HI".

Now try sending a different word to the class. The Binary to Alphabet resource below shows the binary patterns for the 26-letter alphabet; you can use yes/no for 1/0, but you could also use other ways of saying them, such as "on/off", "up/down", or even "one/zero". In particular, it may be helpful to represent a number higher than 16 to give them experience with the 5th bit.

Teaching observations

Note that if your local alphabet is slightly different (e.g. has diacritics such as macrons or accents.) then you may wish to adapt the code to match the common characters; this issue is also considered below.

Lesson activities

Let’s work this out how to write our own binary code for “dad”.

You sing/say the alphabet slowly and I’ll count how many letters go by until we get to ‘D’ (D is the 4th letter).

So how do we make 4 using binary code?

Kids holding binary cards


You sing the alphabet slowly and I’ll count how many letters go by until we get to ‘A’. A is the 1st letter .

So how do we make 1 using binary code?

Kids holding binary cards


Hang on! Haven’t we already written the binary code for D? We can reuse that! Computer Scientists always look for ways to reuse any work they have done before. It’s much faster this way.

Now let’s try this with someone’s name? Whose name should we translate into binary numbers?

Choose a student and work through the steps to create their name.

To reinforce students' alphabet knowledge, you could translate all student's name into binary numbers onto a piece of card and display it around the room.

Teaching observations

Some languages have more or fewer characters, which might include those with diacritic marks such as macrons and accents. If students ask about an alphabet with more than 32 characters, then 5 bits won't be sufficient. Also, students may have realised that a code is needed for a space (0 is a good choice for that), so 5 bits only covers 31 alphabet characters.

A typical English language keyboard has about 100 characters (which includes capital and lowercase letters, punctuation, digits, and special symbols). How many bits are needed to give a unique number to every character on the keyboard? (typically 7 bits will been enough since it provides 128 different codes).

Now have students consider larger alphabets. How many bits are needed if you want a number for each of 50,000 Chinese characters? (16 bits allows for up to 65,536 different representations).

It may be a surprise that only 16 bits is needed for tens of thousands of characters. This is because each bit doubles the range, so you don't need to add many bits to cover a large alphabet. This is an important property of binary representation that students should become familiar with.

Teaching observations

The rapid increase in the number of different values that can be represented as bits are added is exponential growth i.e. it doubles with each extra bit. After doubling 16 times we can represent 65,536 different values, and 20 bits can represent over a million different values. Exponential growth is sometimes illustrated with folding paper in half, and half again. After these two folds, it is 4 sheets thick, and one more fold is 8 sheets thick. 16 folds will be 65,536 sheets thick! In fact, around 6 or 7 folds is already impossibly thick, even with a large sheet of paper.

Lesson reflection

  • What are some reasons why we don’t use the binary number system as the representation for our written language?
  • What did you find challenging during this lesson?
  • How did you overcome these challenges?

Throughout the lessons there are links to computational thinking. Below we've noted some general links that apply to this content.

Teaching computational thinking through CSUnplugged activities supports students to learn how to describe a problem, identify what are the important details they need to solve this problem, and break it down into small, logical steps so that they can then create a process which solves the problem, and then evaluate this process. These skills are transferable to any other curriculum area, but are particularly relevant to developing digital systems and solving problems using the capabilities of computers.

These Computational Thinking concepts are all connected to each other and support each other, but it’s important to note that not all aspects of Computational Thinking happen in every unit or lesson. We’ve highlighted the important connections for you to observe your students in action. For more background information on what our definition of Computational Thinking see our notes about computational thinking.

Algorithmic thinking

We used multiple algorithms in this lesson: one to convert a letter into a decimal number and then into a binary number, and vice versa. These are algorithms because they are a step-by-step process that will always give the right solution for any input you give it as long as the process is followed exactly.

Here’s an algorithm for converting a letter into a decimal number:

Choose a letter to convert into a decimal number. Find the letter’s numerical position in the alphabet as follows: - Say A (the first letter in the alphabet) - Say 1 (the first letter in our sequence of numbers) - Repeat the following instructions until you come to the letter you are looking to convert - Say the next letter in the alphabet - Say the next number (counting up by 1) - The number you just said is the decimal number that your letter converts too.

For example, to convert the letter E, the algorithm would have you counting A,1; B, 2; C, 3; D, 4; E, 5.

girl thinking about alphabet and numbers

(A more efficient algorithm would have a table to look up, like the one created at the start of the activity, and most programming languages can convert directly from characters to numbers, with the notable exception of Scratch, which needs to use the above algorithm.)

The next algorithm takes the algorithm from lesson 1 which we use to represent a decimal number as a binary number:

  • Find out the number of dots that is to be displayed. (We'll refer to this as the "number of dots remaining", which initially is the total number to be displayed.)
  • For each card, from the left to the right (i.e. 16, 8, 4, 2, then 1):
    • If the number of dots on the card is more than the number of dots remaining:
      • Hide the card
    • Otherwise:
      • Show the card
      • Subtract the number of dots on the card from the number of dots remaining

Examples of what you could look for:

Can students create instructions for, or demonstrate, converting a letter into a decimal number, and then convert a decimal number into binary; are they able to show a systematic solution?


This activity is particularly relevant to abstraction, since we are representing written text with a simple number, and the number can be represented using binary digits, which, as we know from lesson 1, are an abstraction of the physical electronics and circuits inside a computer. We could also expand our abstraction because we don’t actually have to use 0s and 1s to represent our message. We could use any two values, for example you could represent your message by flashing a torch on and off, or drawing a line of squares and triangles on the whiteboard.


Abstraction helps us simplify things because we can ignore the details we don’t currently need to know. Binary number representation is an abstraction that hides the complexity of the electronics and hardware inside a computer that stores data. Letters are an abstraction that a human can make sense of quickly; talking about the letter H is generally more meaningful than calling it "the 10th letter of the alphabet", and when we are reading or speaking we don’t need to know it is the 10th letter anyway.

Examples of what you could look for:

Have students create instructions for, or demonstrate how to represent new language elements, such as a comma.

Generalising and patterns

Recognising patterns in the way the binary number system works helps give us a deeper understanding of the concepts involved, and assists us in generalising these concepts and patterns so that we can apply them to other problems.

Examples of what you could look for:

Have students decode a binary message from another student, by converting the binary numbers into text to view the message. Can they recognise patterns in the binary to anticipate what the word is? Can they work with a different set of letters using the same principles?


Logical thinking means recognising what logic you are using to work these things out. If you memorise how to represent that the letter H is represented as binary 01010 it's not as generally applicable as learning the logic that any character can be represented by the process described in this activity.

Examples of what you could look for:

Observe the systems students have created to translate their letters into binary and vice versa. What logic has been applied to these? Are they efficient systems?


An example of decomposition is breaking a long message such as 00001000100001011001 into 5-bit components (00001 00010 00010 11001), each of which can now be converted to a letter. The 5-bit components are then decomposed into the value of individual bits.

Examples of what you could look for:

Can students convert a coded message with no spacing in it?


An example of evaluation is working out how many different characters can be represented by a given number of bits (e.g. 5 bits can represent 26 characters comfortably, but 6 bits are needed if you have more than 32 characters, and 16 bits are needed for a language with 50,000 characters.

Examples of what you could look for:

Can a student work out how many bits are needed to represent the characters in a language with 50 characters? (6 bits are needed) How about represent emojis, if you have about 10 emojis available (10 bits will be needed for each one).