Study Guide
Representing Text
How a computer stores letters, digits and symbols as binary numbers using a character set, how ASCII works, and why Unicode was needed as well.
Lesson 1.6 Data Representation
For: Cambridge IGCSE Computer Science learners, or anyone who can already convert between binary and denary
Stage: Think
Notes in number code
Two fictional friends, Mei and Joe, pass notes in class using a secret code. Each letter is replaced by its place in the alphabet: A is 1, B is 2, C is 3, and so on.
Think it through
What numbers stand for the word CAT in Mei and Joe’s code? A computer can only store patterns of bits, so why might it need a code like this to store a message?
- Hint 1: Count along the alphabet: A is 1, B is 2, C is 3.
- Hint 2: What can a computer store: letters, or something else?
Letters, digits, punctuation marks and spaces are all characters. For a computer to store text, every character is given a number, and that number is stored in binary. Mei and Joe’s list is a very small example of a character set: an agreed list of characters, each with its own code.
The list has to be agreed. If Joe used A = 0 instead of A = 1, every message from Mei would be read wrongly. Computers are the same: the sender and the receiver must use the same character set.
Stage: Discover
How many bits does a character need?
A fictional robot understands only eight symbols. Each symbol must have its own different pattern of bits.
Think it through
How many bits does each symbol need, if the robot knows eight symbols? What about 26 symbols, one for each capital letter?
- Hint 1: n bits can make 2ⁿ different patterns. How many patterns do 2 bits make, and 3 bits?
- Hint 2: For 26, find the smallest number of bits that makes at least 26 patterns.
Show what happens
Eight symbols need 3 bits, because 2³ = 8 patterns. Twenty-six symbols need 5 bits: 4 bits make only 2⁴ = 16 patterns, which is too few, and 5 bits make 2⁵ = 32, which is enough (with 6 patterns spare).
Check your understanding
Show the answer
Answer: B. 7 bits, because 7 bits make 128 patterns.
2⁶ = 64 is too small and 2⁷ = 128 is enough, so 7 bits is the fewest. The more characters a set holds, the more bits each code needs.
Stage: Discover
ASCII: a code for English text
Computers need one common list, so a standard was agreed in the 1960s. Here are some of its codes, written in denary:
| Character | Code | Character | Code |
|---|---|---|---|
| A | 65 | a | 97 |
| B | 66 | b | 98 |
| C | 67 | c | 99 |
| D | 68 | d | 100 |
| 0 | 48 | 2 | 50 |
| 1 | 49 | 9 | 57 |
Think it through
Look at the patterns. What would the codes for E, for c and for the digit 3 be? And how far apart are A and a?
- Hint 1: Which way do the codes run along the alphabet?
- Hint 2: Subtract the code for A from the code for a.
Show what happens
E is 69, c is 99 and the digit 3 is 51. The codes follow the order of the alphabet and of the digits, so one code is enough to work out its neighbours. A is 65 and a is 97, so a lower-case letter is 32 above its capital.
This list is part of ASCII, the American Standard Code for Information Interchange. ASCII uses 7 bits for each character, so it has 2⁷ = 128 characters, with codes 0 to 127. They include capital and lower-case English letters, the digits, punctuation, the space (code 32) and some control codes, such as the one for a new line.
Seven bits is an awkward size to store, so each ASCII code is normally kept in a byte of 8 bits, with a 0 added on the left. 65 is 100 0001 in 7 bits and 0100 0001 in a byte.
You are never expected to memorise ASCII codes. A question gives you the ones you need, as the table above does.
| Character | Denary code | 8-bit binary code |
|---|---|---|
| A | 65 | 0100 0001 |
| C | ||
| a | ||
| 5 | ||
| z |
- Use the table: a is 97 and the digit 0 is 48. Count along from the nearest code you know.
- Convert the denary code to binary as in the first lesson, then add a 0 on the left if only seven bits are needed.
Show the completed table
| Character | Denary code | 8-bit binary code |
|---|---|---|
| A | 65 | 0100 0001 |
| C | 67 | 0100 0011 |
| a | 97 | 0110 0001 |
| 5 | 53 | 0011 0101 |
| z | 122 | 0111 1010 |
Stage: Predict
The digit 7 is not the number 7
When you type 7 in a text message, the computer stores it as a character, with its own code in the character set. That is different from storing the number seven.
Think it through
In the first lesson, seven in binary was 0000 0111. Do you think a phone stores the character 7 in a text message as 0000 0111? Give a reason, and say which pattern you think it might use.
- Hint 1: Which table gives every character a code? Where does the digit 0 come in it?
Show what happens
It does not. The character 7 has its own code in ASCII, which is the digit 0 (code 48) plus 7, giving 55, or 0011 0111. The number seven kept as a number is 0000 0111, but a character is stored by looking up its code.
Storing the number seven gives 0000 0111, as in the first lesson. Storing the character 7 gives its ASCII code, 55, which is 0011 0111. The digit characters run in order from 0 = 48, so 7 = 48 + 7 = 55. A computer needs both: numbers it can calculate with, and digits as text it can display, such as the digits of a phone number.
Check your understanding
Show the answer
Answer: C. 0011 0100, because the code for 0 is 48 and 4 is 52.
The character 4 has ASCII code 52, which is 0011 0100. The number four kept as a number would be 0000 0100.
Now work the other way. A fictional text arrives as three bytes. You know that A is 65, B is 66 and so on.
| Binary | Denary code | Character |
|---|---|---|
| 0100 0100 | 68 | D |
| 0100 1111 | ||
| 0100 0111 |
- Convert each byte to denary first.
- Then count along the alphabet from A = 65.
Show the completed table
| Binary | Denary code | Character |
|---|---|---|
| 0100 0100 | 68 | D |
| 0100 1111 | 79 | O |
| 0100 0111 | 71 | G |
The three bytes spell DOG. The computer does not know it is reading a word: it follows the character set, one byte at a time.
Stage: Think
When 128 characters are not enough
ASCII has 128 characters. That covers English text, but a fictional chat app called ChatBox is used by pupils who write in English, Arabic, Japanese and Polish, and who send emojis.
Think it through
Why can’t the 128 ASCII characters hold everything ChatBox needs? What could a designer do to give each character a code?
- Hint 1: Think of one Polish letter with an accent, or an emoji. Is it in the ASCII table?
- Hint 2: What happens to the number of patterns when each code has more bits?
Show what happens
ASCII has no accented Polish letters, no Arabic or Japanese characters and no emojis. A designer can give every character a code by using more bits for each code, because every extra bit doubles the number of patterns.
One fix is extended ASCII, which uses all 8 bits of a byte. That gives 2⁸ = 256 characters: the first 128 are the same as ASCII and the extra 128 hold accented letters and symbols. But 256 is still too few for the world’s writing, and different versions of extended ASCII use the extra codes for different characters.
The lasting fix is Unicode: one character set designed to cover the writing systems of the world, as well as symbols and emojis. It has a far greater range of characters than ASCII, and so its codes need more bits per character. Some forms of Unicode use 16 or 32 bits for every character. 16 bits make 2¹⁶ = 65 536 patterns, and 32 bits make over four billion.
The first 128 Unicode codes are the same as ASCII, so text in plain English has the same codes in both.
Check your understanding
Show the answer
Answer: A. ASCII has too few codes for many languages and emojis, so a set with more bits per character was needed.
ASCII’s 128 characters (256 in extended ASCII) cannot cover the characters of many languages and emojis. Unicode has a much greater range, so each character needs more bits.
Unicode was built to include ASCII. The first 128 Unicode codes are the ASCII codes, so A is still 65. Unicode adds characters; it does not change the old ones. That is why both are still taught and used: ASCII is a small, simple character set, and Unicode is the larger one that includes it.
Stage: Apply
What more bits cost
More bits per character lets a character set hold more characters, but it also makes a stored message longer. A fictional school newsletter has 500 characters.
Apply it
Apply it
Show the answer
Answer: B. Unicode, because it has a large enough range for Chinese characters and Spanish accents.
The shop needs characters that ASCII does not have, so it needs Unicode. Unicode costs more bits per character, but without it the Chinese names could not be stored at all.
Apply it
Show the answer
Answer: C. For text with only English letters and digits, ASCII is enough and takes less space.
Neither is better in every case. Unicode has the greater range, and ASCII needs fewer bits per character. The right choice depends on which characters have to be stored.
Go deeper Beyond the specification: how one Unicode form saves space
The forms of Unicode described above give every character the same number of bits. A popular form called UTF-8 uses a different plan: it stores the 128 ASCII characters in one byte each, and uses two, three or four bytes for the rest. English text then takes about the same space as ASCII, and other languages take more. This is why UTF-8 is common on websites. The specification only asks you to know that Unicode needs more bits per character than ASCII.
Stage: Consolidate
Bring it together
Think it through
Without looking back, explain to a friend how a computer stores the word “Hi” in a text message, and why a phone needs Unicode as well as the idea behind ASCII.
Show a model answer
Each character has a code in a character set: H is 72 and i is 105 in ASCII, and each number is stored in binary (0100 1000 and 0110 1001). A phone needs Unicode because ASCII’s 128 characters cannot hold other languages or emojis, and Unicode gives each character a longer code with more bits.
Check your understanding
Show the answer
Answer: A. 256, because 2⁸ = 256.
2⁸ = 256. The codes 0 to 127 are the same as ASCII, and codes 128 to 255 are the extra characters.
- A computer stores text by giving every character a number from a character set, and storing that number in binary. The sender and the receiver must use the same character set.
- With n bits, a character set can have 2ⁿ characters, so more characters need more bits for each code.
- ASCII uses 7 bits, so it has 128 characters (A is 65, a is 97, the digit 0 is 48), and is normally stored in a byte. Extended ASCII uses 8 bits and has 256.
- The character 7 as text has its own code (55), which is not the number seven in binary.
- Unicode has a far greater range, including other languages and emojis, and needs more bits per character. Its first 128 codes match ASCII.
- ASCII is enough when only English letters and digits are stored, and uses less space. Unicode is needed when the range matters.
Sources and scope
- What this lesson is. The sixth lesson of the Data Representation module, written for this site. It teaches point 1 of Cambridge IGCSE Computer Science 1.2 (text and character sets) against the 2026 to 2028 syllabus (version 6). Its curriculum links are provisional: no link has been verified by the site owner. They show where the lesson may help with a course and imply no review or endorsement by any examination board.
- Original material. Mei and Joe’s secret code, the robot with eight symbols, ChatBox, the school newsletter, the museum shop and Adaeze’s claim are fictional examples written for this lesson. The ASCII codes used are the standard ones (for example A = 65, a = 97, 0 = 48).
- Simplified on purpose. Only the codes needed are shown, and no one is expected to memorise them. ASCII control codes and the many versions of extended ASCII are only named. Unicode is described by its range and its need for more bits per character; code points, and the different forms of Unicode, are left to the optional extension and to later study.
A character set that uses 7 bits for each character, giving 128 characters, such as the English letters, digits and punctuation.
The number system with only two digits, 0 and 1, in which each column is worth twice the column to its right.
A single binary digit: 0 or 1. The smallest unit of data a computer stores.
A group of eight bits, which can hold one of 256 different patterns.
An agreed list of characters, each with its own binary code, so that text can be stored and read back the same way.
The everyday number system with ten digits, 0 to 9, in which each column is worth ten times the column to its right.
A character set with a far greater range than ASCII, covering the writing of many languages as well as symbols and emojis, which needs more bits for each character.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.