All subjects · Computer Science · WCP01 Principles of Computer Science

Character encoding: ASCII, extended ASCII, Unicode and UTF-8

Edexcel IAL Computer Science · WCP01 Principles of Computer Science

Text is stored by giving each character a number, called its code. A character set defines the codes (spec point 2.3.1).

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

ASCII and extended ASCII

Unicode and UTF-8

CharacterCode pointUTF-8 bytes
AU+0041 (65)1
éU+00E9 (233)2
€U+20AC (8364)3
😀U+1F600 (128512)4

Calculating text sizes

Storage = number of characters x bits per character. 500 characters in 7-bit ASCII need 3500 bits; in 8-bit extended ASCII, 500 bytes.

Worked example

The ASCII code for 'D' is 68. Find the code for 'h' and give it in 8-bit binary.

  1. 'h' is 4 letters after 'd'; 'd' = 68 + 32 = 100
  2. 'h' = 104
  3. 104 = 0110 1000

Answer: 104 = 0110 1000

Key idea: ASCII 7 bits, 128 codes; extended ASCII 8 bits, 256 codes; Unicode code points for every writing system; UTF-8 uses 1 to 4 bytes and matches ASCII for the first 128.

Check yourself

  1. The ASCII code for 'A' is 65. What is the code for 'G'?
    Show answer

    71. G is 6 letters after A: 65 + 6 = 71.

  2. The ASCII code for 'M' is 77. What is the code for 'm'?
    Show answer

    109. Lower case = upper case + 32: 77 + 32 = 109.

  3. How many different characters can 7-bit ASCII represent?
    Show answer

    128. 27 = 128.

  4. A message of 250 characters is stored in 8-bit extended ASCII. How many bits does it need?
    Show answer

    2000 bits. 250 x 8 = 2000 bits.

  5. In UTF-8, how many bytes are used for the string 'Café' (C, a, f and é)?
    Show answer

    5. C, a and f are ASCII (1 byte each); é needs 2 bytes: 3 + 2 = 5.

  6. Why was Unicode developed?
    • ASCII used too many bits per character
    • Computers could not store numbers
    • To make English text use more bytes
    • ASCII and extended ASCII could not represent the characters of most of the world's languages
    Show answer

    ASCII and extended ASCII could not represent the characters of most of the world's languages. 128 or 256 codes are far too few for scripts such as Chinese, Arabic or Hindi.

  7. Which is a benefit of UTF-8?
    • Every character uses exactly one byte
    • Text written in ASCII is also valid UTF-8
    • It can only represent English
    • It uses fixed 4-byte codes, so it is easy to index
    Show answer

    Text written in ASCII is also valid UTF-8. UTF-8 keeps ASCII codes as single bytes, so old text still works.

  8. The ASCII code for '0' is 48. What is the ASCII code for the character '7'?
    Show answer

    55. 48 + 7 = 55. Note that the character '7' is not the number 7.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.