← ACARA Digital Technologies Years 5–6

Encode and decode

To encode is to turn information into a code. To decode is to turn the code back into the information, using a key. They are opposites.

Understanding Encode and decode in ACARA Digital Technologies Years 5–6

What it does: The picture is turned into a code of 0s and 1s, which is encoding. To encode is to change information into a code. Decode does the opposite. Leo turns the code back into letters using the key. That is decoding. The key tells you what each code stands for. Without the right key the message can't be decoded correctly.

Common mistakes: To get the message back from the code you must decode, not encode. Line 4 should be answer ← decode(code, key). The secret message is text, so it needs quote marks. Line 2 should be message ← "BAC".

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 44–57) and word search (Modules 44–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which word means turning information into a code?
DecodeEncode
Matches
decode("CAT") gives 3 1 20
↓
This turns the word into a code, so it is encoding. Decoding should turn the code back into the word.
Applying
Meanings
Term
encode / decode
Meaning
To encode is to turn information into a code. To decode is to turn the code back into the information, using a key. They are opposites.
Practice
key ← A=1, B=2, C=3
Testing
Gaps
code ← (message, key)
Check Answer
Spots
3code ← encode(message, key)
4answer ← encode(code, key)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Sea Turtle' badge — Scope Navigator, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which word means turning information into a code?
A. Decode
B. Encode ✓
To encode is to change information into a code. Decode does the opposite.
2. Which word means turning a code back into the information?
A. Encode
B. Decode ✓
To decode is to use the key to turn the code back into the original information.
3. Mia swaps each letter in her message for a number, so A becomes 1 and B becomes 2. What is she doing?
A. Encoding the message ✓
B. Decoding the message
She is turning words (information) into numbers (a code), so she is encoding.
4. Leo gets the secret message 8 9. He uses the key A=1, B=2 and so on to read it as HI. What is he doing?
A. Decoding the message ✓
B. Encoding the message
Leo turns the code back into letters using the key. That is decoding.
5. Which statement is true about encode and decode?
A. They are opposites ✓
B. They mean the same thing
Encoding makes the code. Decoding undoes it and gets the information back.

Match the Pairs

encode("CAT") gives 3 1 20 → Turns the word CAT into number codes, so the information is now in code
decode("3 1 20") gives CAT → Uses the key to turn the number codes back into the word
Encoding a black-and-white picture: black pixels become 1 and white pixels become 0 → encode(picture) gives 0 1 1 0
Decoding with a key: the key says 1 means black and 0 means white, so the digits become a picture again → decode("0 1 1 0", key) gives picture
decode("CAT") gives 3 1 20 → This turns the word into a code, so it is encoding. Decoding should turn the code back into the word.
decode("3 1 20") without a key → Decoding needs the key. Without it you cannot tell which number stands for which letter.

Key Term

encode / decode
To encode is to turn information into a code. To decode is to turn the code back into the information, using a key. They are opposites.

Fill in the Blanks

1. message ← "CAB" code ← encode(message, key)
Hint: Type the function name that turns the message into a code.
2. code ← "3 1 2" message ← decode(code, key)
Hint: Type the function name that turns a code back into the message.
3. code ← "3 1 2" message ← decode(code, key)
Hint: Type the variable name for the thing needed to read the code.
4. picture ← [0, 1, 1, 0] code ← encode(picture, key)
Hint: Type the variable that holds the information being turned into a code.
5. code ← encode(message, key) original ← decode(code, key) output original
Hint: Type the function that is the opposite of encode, to get the original back.

Spot the Error

Question 1
A key ← A=1, B=2, C=3
B message ← "CAB"
C code ← encode(message, key)
D answer ← encode(code, key)
E show answer
Line D — To get the message back from the code you must decode, not encode. Line 4 should be answer ← decode(code, key).
Question 2
A key ← A=1, B=2, C=3
B message ← BAC
C code ← encode(message, key)
D show code
Line B — The secret message is text, so it needs quote marks. Line 2 should be message ← "BAC".
Question 3
A row ← black, white, black
B key ← black=1, white=0
C code ← decode(row, key)
D show code
Line C — Turning a picture row into 0s and 1s is encoding, not decoding. Line 3 should be code ← encode(row, key).
Question 4
A code ← 1, 0, 1
B key ← 1=black, 0=white
C row ← decode(code)
D show row
Line C — Decoding needs the key to know what each number means. Line 3 should be row ← decode(code, key).
Question 5
A key ← A=1, B=1, C=3
B word ← "ABC"
C code ← encode(word, key)
D show code
Line A — A and B share the number 1, so you could not decode it back. Each letter needs its own number. Line 1 should be key ← A=1, B=2, C=3.

Student with a class code? Join your class →