Stewdent.eu
▾

ASCII and Character Encoding

ASCII is a standard that assigns a unique number to each character so computers can store and share text.

Last updated: 6 December 2025

★★☆☆☆ Level 2computingDatadata-representationasciiencodingtext3 min read

Report an error

The Problem: Computers Only Understand Numbers

A computer stores everything as binary numbers. But how does it store a letter like A or a symbol like ?? Humans and computers needed to agree on a shared system: a table that maps each character to a specific number.

What is ASCII?

ASCII stands for American Standard Code for Information Interchange. It was created in the 1960s and assigns a 7-bit number (0–127) to 128 characters, including:

  • Uppercase letters (A–Z)
  • Lowercase letters (a–z)
  • Digits (0–9)
  • Punctuation marks (!, ?, ., etc.)
  • Special control characters (like "new line" or "tab")

Here are some key ASCII values to know:

CharacterDecimalBinary
A651000001
B661000010
a971100001
0480110000
Space320100000
Note

Notice that uppercase letters start at 65 and lowercase at 97. The difference is exactly 32. This makes it easy for programs to switch between cases — just add or subtract 32 from the ASCII value.

Limitations of ASCII

ASCII was designed for English. It cannot represent:

  • Letters with accents: é, ü, ñ
  • Non-Latin scripts: Chinese, Arabic, Greek
  • Modern symbols: emoji, currency signs like €

With only 128 values, ASCII simply does not have room for the world's languages.

Unicode and UTF-8

To fix ASCII's limitations, Unicode was created. It defines over 140,000 characters covering almost every writing system on Earth, plus thousands of emoji.

UTF-8 is the most popular way of encoding Unicode text. It is clever because:

  • Standard ASCII characters still use just 1 byte (staying compatible with old systems)
  • Less common characters use 2, 3, or 4 bytes as needed

Today, nearly all websites and modern software use UTF-8.

Tip

If you have ever seen garbled text like "é" where there should be "é", that is a character encoding mismatch — the file was saved in one encoding and opened with another.

How Much Space Does Text Use?

In ASCII or UTF-8, a typical English character takes 1 byte. So:

  • "Hello" = 5 bytes
  • A 500-word essay ≈ 3,000 bytes ≈ 3 KB

This is one reason plain text files are tiny compared to images or videos.

Practice Problems

Using the ASCII table, what is the binary representation of the word 'Hi'? (H = 72, i = 105)

Show answer
H = 72 = 01001000. i = 105 = 01101001. So 'Hi' in binary is 01001000 01101001.

Why was Unicode developed to replace ASCII, and what is the main advantage of UTF-8 over a fixed-width Unicode encoding?

Show answer
Unicode was developed because ASCII only supports 128 characters and cannot represent non-English languages, accented characters, or emoji. UTF-8's advantage is variable-length encoding — common characters use 1 byte (keeping ASCII compatibility and saving space), while rarer characters use more bytes only when needed.