Skip to main content
Skip to main content

Ciphering a sentence

Integrating Digital Technologies
Years 3-4; 5-6

DT+ English

A cipher is a message that has been written in such a way (encoded) that it is unreadable by others. In this lesson, students will use mapping to encode a sentence. Students will work with a partner to create an algorithm that describes the encryption process. They will also examine encoded and decoded messages to recognize patterns to help decode messages and develop strategies to decompose the problem.

Based on the original lessons developed by the Exploring Computational Thinking team at Google.

Learning hook: Forming a strategy (10 minutes)

In this activity, students will think about strategies for sending messages that are guaranteed to be private.

Pretend that you want to send a private message to a friend. The only way you can deliver the message is to write it on a board that is observable by anyone who passes by. What could you and your friend do to ensure that you are the only people who can understand the message?

Think-Pair Share: Instruct students to think for one minute about how they might accomplish the task. Then pair students to discuss their ideas and to agree by consensus on a strategy that would work. After 2 or 3 minutes, invite students to share their ideas in a large group discussion.

Learning demonstration: Create the alphabet mapping (25 minutes)

In this activity, students write rules for mapping and reordering the alphabet for encoding messages to create an algorithmic cipher.


Use the rules below to create ciphers.

Create two rules for mapping the alphabet.

Sample rules:

  • The characters are divided into two groups: (1) characters for which the image of their uppercase form has an enclosed area (such as P or O) and (2) characters that do not have an enclosed area in in the image of their uppercase form (such as I or Z).
  • Sort the two groups alphabetically, with group 1 first and then group 2.

Apply the rules.

Applying rule 1:

Group 1: {A, B, D, O, P, Q, R}

Group 2: {C, E, F, G, H, I, J, K, L, M, N, S, T, U, V, W, X, Y, Z}

Applying rule 2:

A, B, D, O, P, Q, R, C, E, F, G, H, I, J, K, L, M, N, S, T, U, V, W, X, Y, Z

Place the letter sequence that resulted from Rule 2 in the second row of the following table beneath the number 1 to 26 (example completed below).

This table shows a one-to-one alphabet mapping (matching one letter with one number), Alphabet Mapping #1.

Now, invent a third rule and apply it to the above mapping to come up with another one-to-one alphabet mapping table. A third rule could be to place the even-number-mapped letters in alphabetical order followed by the odd-number-mapped letters in alphabetical order. Let’s call that Alphabet Mapping #2.

Teaching Tips:

  • With older or more advanced groups, present the above steps to the class as an example in a large group before breaking students into pairs to create their own alphabet mappings.

Learning construction: Encode sentences (20 minutes)

In this activity, students will use the algorithm mappings from Learning demonstration to encode sentences.


Divide students in groups of two and tell them the following:

  • Think of a simple message you would like to send to your partner.
  • Encode it three times: first use just Alphabet Mapping #1, then use just Alphabet Mapping #2, and then use both mappings from the previous activity.

For example, if the sentence is:

We drove to the gym.

Using the Alphabet Mapping #1, we find each letter of the sentence in the second row of the table created in Activity 1. We replace the letter with the corresponding number in the first row.

Please note that one must place letter breaks (the character “_”) and separate each word by a blank space. In this example, the encoded sentence is:

23 9     3 7 4 22 9     20 4     20 12 9     11 25 17

Teaching Tips:

  • If students created their own mappings in the previous activity, have them use those mappings in this activity.

Learning reflection: Analysis and reflection (20 minutes)

In this activity, students will decompose their own ciphers, how ciphers might be represented with a computer program, and some of the issues in breaking and designing ciphers (recognizing patterns).


Tell students to discuss and record answers to the following questions in their journals with their partners.

  1. Which Alphabet Mapping (1 or 2) is easier to use to encode a message?
  2. Are the rules used for Alphabet Mapping #1 clear and easy to understand? How could you improve the rules?
  3. Is your new rule for Alphabet Mapping #2 clear and easy to understand? How could you improve your rule?
  4. How would you implement your cipher in a computer program? Could you break down the problem and write the sequence of steps (an algorithm) that describes the process?
  5. Imagine that another person gives you an encoded message and you do not know the mapping tables. How would you go about deciphering or decoding the sentences? What patterns would you look for to help you discover the one-to-one mapping?
  6. If someone wants to come up with a cipher that is very difficult to for others to decode, what are some of the strategies that he or she should consider to break down the problem (decomposition)?


  • Collect students’ reflections. Assess for thoughtful, complete responses.

Additional information and resources

Lesson Vocabulary

Computational Thinking concepts

Additional Resources