Character Encoding

GCSE Computer Science · Data Representation

Character Encoding

Character encoding is a system that assigns a unique binary number to every character (letters, digits, symbols) so computers can store and process text.

---

Why Encoding Is Needed

Computers only understand binary (0s and 1s). To store the letter "A", the computer needs a numeric code that both the sender and receiver agree on. Without a standard encoding, text would appear as random symbols.

---

ASCII (American Standard Code for Information Interchange)

ASCII was one of the first character encoding standards, developed in the 1960s.

Key Facts

PropertyDetail
Bits per character7 bits (extended ASCII uses 8)
Total characters128 (7-bit) or 256 (8-bit extended)
IncludesUppercase A–Z, lowercase a–z, digits 0–9, punctuation, control codes
Does not includeCharacters from non-Latin alphabets (Chinese, Arabic, etc.)

ASCII Code Table (Key Values)

CharacterDecimalBinary (7-bit)
Space320100000
0480110000
9570111001
A651000001
Z901011010
a971100001
z1221111010

Important Patterns

  • Uppercase letters start at 65 (A) and go to 90 (Z)
  • Lowercase letters start at 97 (a) and go to 122 (z)
  • The difference between uppercase and lowercase is always 32 (e.g. A=65, a=97)
  • Digits 0–9 start at 48

---

Worked Conversions

Example 1: Character to Binary

Convert "C" to binary:

1. "C" = ASCII code 67

2. 67 in binary: 64 + 2 + 1 = 1000011

Example 2: Binary to Character

Convert 1001000 to a character:

1. 1001000 = 64 + 8 = 72

2. ASCII 72 = "H"

Example 3: Encode a Word

Encode "Hi" in 7-bit ASCII:

  • "H" = 72 = 1001000
  • "i" = 105 = 1101001
  • Result: 1001000 1101001

Calculating File Size with ASCII

A text file containing "Hello" (5 characters) in 8-bit ASCII:

  • 5 characters × 8 bits = 40 bits = 5 bytes

---

Unicode

Unicode was developed to solve ASCII's limitation of supporting only English characters.

Key Facts

PropertyDetail
Bits per characterVariable: UTF-8 (8–32 bits), UTF-16 (16–32 bits), UTF-32 (32 bits)
Total charactersOver 143,000 characters
IncludesEvery language (Chinese, Arabic, Hindi, etc.), emoji, mathematical symbols
Backwards compatibleThe first 128 Unicode values match ASCII exactly

UTF-8 (Most Common Encoding)

  • Uses 1 to 4 bytes per character
  • English characters use 1 byte (same as ASCII)
  • Characters from other languages use 2–4 bytes
  • This makes it space-efficient for English text

UTF-16 and UTF-32

EncodingBytes per characterBest for
UTF-81–4Web pages, English-heavy text
UTF-162–4Mixed-language text
UTF-324 (fixed)Fast processing (fixed width)

---

ASCII vs Unicode Comparison

FeatureASCIIUnicode
Characters128 / 256143,000+
LanguagesEnglish onlyAll languages
Bits per character7 or 88–32 (varies)
File sizeSmallerLarger (for non-English)
Emoji supportNoYes
CompatibilitySubset of UnicodeIncludes ASCII

---

How Character Sets Affect File Size

The number of bits per character directly affects storage:

ScenarioCalculationSize
100 chars in ASCII (8-bit)100 × 8 = 800 bits100 bytes
100 chars in UTF-8 (English)100 × 8 = 800 bits100 bytes
100 chars in UTF-16100 × 16 = 1,600 bits200 bytes
100 chars in UTF-32100 × 32 = 3,200 bits400 bytes

More bits per character = larger file size but more characters available.

---

Exam Tips

  • You must know that ASCII uses 7 bits (128 characters) and Unicode supports all languages
  • Be able to convert between characters and their ASCII codes using the table
  • Remember: the difference between upper and lowercase in ASCII is 32
  • A common calculation question: file size = number of characters × bits per character
  • Unicode is backwards compatible with ASCII — the first 128 codes are identical
  • Know why Unicode was needed: globalisation required representing characters from all languages and scripts
Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

More on Data Representation

Binary and Denary Hexadecimal Binary Arithmetic and Shifts Characters, Images and Sound Compression Sound and Image Representation

← All GCSE Computer Science notes