ASCII vs Unicode vs UTF-8

Intermediate · 6 min read · Updated 28 November 2026

In shortASCII is a 7-bit code for 128 English characters. Unicode is the master list that gives every character in every language a number (a code point, such as U+00E9 for é). UTF-8 is the most common way to store those code points as bytes — ASCII characters take 1 byte, and other characters take 2 to 4 bytes.

Three layers

  1. Character — the idea of “é”.
  2. Code point (Unicode) — its number: U+00E9 (233).
  3. Encoding (UTF-8) — the bytes on disk: C3 A9, or in binary 11000011 10101001.

ASCII squashes layers 2 and 3 together: the code point is the byte, but only for 128 characters.

The same characters in each system

Character Unicode UTF-8 bytes (hex) UTF-8 in binary
A U+0041 41 01000001
é U+00E9 C3 A9 11000011 10101001
€ U+20AC E2 82 AC 11100010 10000010 10101100
😀 U+1F600 F0 9F 98 80 11110000 10011111 10011000 10000000

Paste any of these into the text to binary converter to check.

How UTF-8 packs the bits

Code point range Bytes Pattern
U+0000 – U+007F 1 0xxxxxxx
U+0080 – U+07FF 2 110xxxxx 10xxxxxx
U+0800 – U+FFFF 3 1110xxxx 10xxxxxx 10xxxxxx
U+10000 – U+10FFFF 4 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

The leading bits of the first byte say how many bytes follow, and every continuation byte starts with 10. A decoder can therefore jump into the middle of a file and resynchronise — a clever design by Ken Thompson and Rob Pike in 1992.

Which should you use?

Use UTF-8 for everything: web pages, files, databases, APIs. It is the default for HTML5 and is used by the overwhelming majority of websites. Use the ASCII table as a quick reference for the first 128 codes, which are the same in all three.

Frequently asked questions

Is UTF-8 the same as Unicode?

No. Unicode assigns numbers to characters; UTF-8 is one encoding that turns those numbers into bytes. UTF-16 and UTF-32 are other encodings of the same Unicode numbers.

Is ASCII a subset of UTF-8?

Yes. Every valid ASCII file is also a valid UTF-8 file with identical bytes, which is a big reason UTF-8 took over.

Why do I see characters like é instead of é?

That is “mojibake” — UTF-8 bytes (C3 A9) being read as Windows-1252, where C3 is à and A9 is ©. Re-open the file as UTF-8 to fix it.

Next: Binary in Python →

Related tools and guides