Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

ASCII vs Unicode (and UTF-8): how text becomes bits

ASCII is a 7-bit character code with 128 codes, 0 to 127: the English letters, digits, punctuation and control characters such as newline, so the letter A is 65 (01000001). Unicode is a much larger catalogue that gives a number, called a code point, to the characters of nearly every writing system, plus symbols and emoji, from U+0000 up to U+10FFFF. Unicode itself is a list of numbers; an encoding decides how those numbers become bytes. UTF-8, the encoding defined in RFC 3629, uses 1 to 4 bytes per character and maps the first 128 code points to the same single bytes as ASCII, so every plain ASCII file is already valid UTF-8. ASCII is a small code; Unicode is the big one; UTF-8 is the most common way to store Unicode, and it contains ASCII unchanged.

What each one is good at

ASCII is simple and compact: one byte per character, and every value is easy to read in binary or hex, which is why it is the first character code programmers and students learn and why protocols are often written in it. Unicode is what makes text in every language possible in one document. UTF-8 combines the two: English text costs one byte per character, exactly as in ASCII, while other characters take two, three or four bytes, and no ASCII byte value ever appears inside a multi-byte character, so ASCII-based software keeps working.

Try it in digiwleea

Look up any ASCII code in decimal, hex and binary in the ASCII table, and turn text into bits and back with the text to binary converter. The ASCII lesson explains how characters become numbers, and the bit vs byte page explains the units. In the lab, a character is just a byte on eight wires, like any other value your circuit computes.

One character, three ways

CharacterCode pointASCIIUTF-8 bytes
AU+004165 (01000001)41
aU+006197 (01100001)61
0U+003048 (00110000)30
é (e with acute)U+00E9not in ASCIIC3 A9
€ (euro sign)U+20ACnot in ASCIIE2 82 AC

The first three rows use one byte in UTF-8, identical to ASCII; the others need two and three bytes.

No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.

More comparisons: Digital logic concepts compared

See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.

Open the digiwleea lab →

Frequently asked

What is the difference between ASCII and Unicode?

ASCII is a 7-bit code with 128 characters, mainly English letters, digits and symbols. Unicode assigns a number to the characters of nearly all writing systems, from U+0000 to U+10FFFF, and the first 128 Unicode code points are the ASCII characters.

Is UTF-8 the same as Unicode?

No. Unicode is the list of characters and their numbers; UTF-8 is one way of storing those numbers as bytes, using 1 to 4 bytes per character. UTF-16 and UTF-32 are other encodings of the same Unicode characters.

Is ASCII text valid UTF-8?

Yes. UTF-8 encodes the code points U+0000 to U+007F as the single bytes 00 to 7F, exactly the ASCII values, so any plain ASCII text is also valid UTF-8.

How many characters does ASCII have?

128, numbered 0 to 127, because it is a 7-bit code. Extended 8-bit character sets add another 128, but they differ from one to another and are not part of ASCII.