Skip to content
All apps

UTF-8 Encoder

About this app

How does ä become c3 a4? A character travels via its code point bit by bit into the UTF-8 template: code point in binary, range with pattern and payload bits, padding, the bits fly from the right behind the control bits 110 and 10, then hex. A text row with every character above its bytes (Grüße: 5 characters, 7 bytes), decoding with Python's UnicodeDecodeError, the ASCII table of the slide, a comparison with UTF-16, UTF-32 and Latin-1, edge cases and the prediction “How many bytes?”.

With explain mode: an AI tutor walks you through the app, points out what matters in the scene and answers your questions.

Code point and UTF-8

Unicode gives every character a number, the code point: U+0000 to U+10FFFF, 1114112 of them. UTF-8 writes this number in one to four bytes. The leading ones of the first byte say how many bytes belong to the character, every continuation byte starts with 10, and the remaining bits are the bits of the code point. ASCII characters up to U+007F stay one byte. That is why ä needs two bytes although 0xE4 fits into one byte as a number: a single UTF-8 byte carries only 7 payload bits.

What the app shows

At the top is a text, every character above its bytes, with the number of characters and bytes. Next to it the range table with pattern and payload bits. Below, the bit distribution for one character runs in steps: code point in binary, choose the range, pad with zeros, then the bits fly from the right into the template behind the control bits, and finally hex appears. Backwards, the app decodes hex bytes and shows Python's UnicodeDecodeError with an explanation for invalid sequences.

Try it yourself

Type A, ä, € and an emoji and predict how many bytes each needs. The ASCII panel shows the complete table of the slide; a click takes the character. The comparison puts UTF-8, UTF-16, UTF-32 and Latin-1 side by side and shows mojibake. Edge cases such as a surrogate, a single byte c3 or chr(0x110000) give the same messages as Python 3.13.

Frequently asked questions

Why does ä need two bytes in UTF-8?
ä has the code point U+00E4, that is 228. A UTF-8 byte on its own always starts with 0 and carries only 7 payload bits, so at most 127. That is why ä is written with the pattern 110xxxxx 10xxxxxx: c3 a4.
Is Unicode the same as UTF-8?
No. Unicode assigns the numbers, the code points. UTF-8 is one of several encodings that write a number as bytes. UTF-32 takes 4 bytes for every character, UTF-8 takes 1 to 4 depending on the code point.
Why is len('Grüße') not the number of bytes?
In Python len counts characters. 'Grüße' has 5 characters, but 'Grüße'.encode('utf-8') has 7 bytes, because ü and ß need two bytes each.
What can I try in the app UTF-8 Encoder?
Encode characters and short texts step by step down to the bytes, decode hex bytes, click the ASCII table, compare encodings and look at edge cases with Python's error messages.

Subject: Computer science

More from Computer science

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps