Skip to content
Crayon CS

Make it comfy

Lesson style

Quick mode shows the key picture, a summary and the practice. Good for a refresher.

Theme
Font

Both fonts are designed to be easy to read. Some readers with dyslexia prefer Lexend.

Text size
Spacing
Animations

Lesson 3 of 7 · about 9 min

Turning letters into numbers

Text is stored by giving every character a number (A = 65), then storing that number in binary. That shared list is called Unicode.

🧭 What you need first: Counting with switches

The story

You now know how to store numbers with switches. But your phone is full of words. How do switches store the letter “A”?

The trick is a simple agreement. Imagine a coat check at a restaurant. You hand over your coat and get ticket #65. The coat isn’t a number, but everyone agrees that #65 means your coat.

Computers do the same with letters. A long time ago, people agreed on a list: “A” gets ticket 65, “B” gets 66, “C” gets 67… To store “A,” the computer stores the number 65 in binary. To show it on screen, it looks up ticket 65 and draws an “A.”

Another way: a secret decoder ring

Remember childhood secret codes where A = 1, B = 2, C = 3? Computers use exactly that idea. They just use a much bigger list that everyone in the world shares, so a message typed in Tokyo shows up correctly in Toronto.

Another way: a phone's contact list

Your phone doesn’t dial “Mom.” It looks up Mom’s number and dials that. Letters work the same way in reverse: the computer stores the number and looks up which letter it belongs to whenever it needs to show it.

Play with it

Watch words turn into switches

Type anything below and watch each character become a number, then a row of switches. Try capital and lowercase letters, a space, and an emoji. Then crack the secret message.

  • H
    ↓ number
    72
    ↓ switches
    01001000
  • i
    ↓ number
    105
    ↓ switches
    01101001
  • !
    ↓ number
    33
    ↓ switches
    00100001

🕵️ Secret message: what word is this?

01000011 01000001 01010100

Hint: turn each group of 8 into a number (use the bulbs from the last lesson), then find the letter. Capital A is 65, B is 66, and so on.

Name it

Grown-up words

The agreed list that turns characters into numbers is called an encoding.

  • ASCII (say “ASK-ee”) was the first popular one, from the 1960s. It had 128 characters: English letters, digits, punctuation. That fits in 7 bits.
  • Unicode is the modern worldwide list. It gives a number to over 150,000 characters: every alphabet, Chinese characters, math symbols, and emoji. The first 128 Unicode numbers are the same as ASCII, so “A” is still 65.
  • UTF-8 is the most common way to store Unicode as bytes. English letters take 1 byte; other characters take 2 to 4 bytes. That’s why the emoji in the widget needed more switches.

One key insight: the same bits can mean different things. 01000001 is the number 65, or the letter A. It depends on which agreement the program is using. Bits don’t know what they mean; programs decide.

Build it

Encode a letter yourself

Capital A is 65, and the alphabet counts up from there. What number is capital D?

Challenge

Spot the pattern

Capital A is 65 (01000001) and lowercase a is 97 (01100001). What's the difference between them?

Remember it

Why can computers show text in every language and emoji today?

Got it?

Finish the lesson to color it in on your map and collect its concept cards.

Did this lesson click?