UTF-8 and Character Encoding Explained
UTF-8 is how text becomes bytes so computers can store and send it. Learn what Unicode and UTF-8 are, why they matter, and how to avoid garbled text.
Character encoding is the map between the characters you see and the bytes a computer stores; UTF-8 is the encoding the modern web uses for almost all text. It can represent every character in every language, plus emoji.
Unicode vs UTF-8
- Unicode assigns every character a unique number called a code point —
Ais 65,€is 8364. - UTF-8 is a way to store those code points as bytes. ASCII characters take one byte; others take two to four.
Why one byte isn't enough
Early encodings used a single byte (256 values), which cannot fit the world's scripts. UTF-8 uses a variable number of bytes, staying compatible with ASCII while covering all of Unicode.
Avoiding garbled text
"Mojibake" — text that shows as é or � — happens when text is written in one encoding and read in another. Always save and serve files as UTF-8, and declare it in HTML with a charset meta tag.
See it in bytes
Watch characters become bytes with the text to binary converter. For escaping in markup, see HTML entities explained.