Encodings
ASCII vs Unicode: Character Encoding Compared
ASCII and Unicode are both systems for mapping characters to numbers, but they operate at vastly different scales. ASCII defines 128 characters — enough for English text and control codes. Unicode defines over a million code points covering virtually every writing system on Earth, with UTF-8 as its dominant byte encoding. Every string you process today is, almost certainly, Unicode encoded as UTF-8. Understanding the difference explains everything from emoji to mojibake to file-size surprises.
1.ASCII: The 7-Bit Foundation
ASCII (American Standard Code for Information Interchange) was standardized in 1963 and encodes 128 characters using 7 bits: 95 printable characters (letters, digits, punctuation) plus 33 control codes. It is the ancestor of all modern character encodings, and its first 128 code points are preserved identically in Unicode. ASCII is wonderfully simple and unambiguous — but it cannot represent accented letters, currency symbols, or any non-English script.
2.Unicode: Every Character, Every Language
Unicode is a computing standard that assigns every character a unique number, called a code point (U+0041 for 'A', U+1F600 for the emoji). It covers scripts from Latin and Cyrillic to Chinese, Arabic, and Devanagari, plus symbols, emoji, and historic scripts. Unicode is not itself an encoding — it is the mapping — and it is delivered to disk and wire through encodings like UTF-8, UTF-16, and UTF-32.
3.UTF-8: The Encoding That Won
UTF-8 encodes Unicode code points into one to four bytes. ASCII characters are a single byte (backward compatible with ASCII), common European characters take two bytes, and emoji and rare scripts take four. UTF-8 is the dominant encoding of the web — over 98% of websites use it — because it is compact for English, handles every language, and is endian-independent. Its variable length explains why "a" is 1 byte but the emoji in the same sentence is 4 bytes.
4.ASCII vs Unicode: Key Differences
The practical differences are capacity, byte size, and compatibility. ASCII is a fixed 7-bit set of 128 characters. Unicode is a mapping of 1.1 million+ code points, typically serialized as variable-length UTF-8. Every ASCII character is identical in Unicode (and in UTF-8), so ASCII text is a strict subset of UTF-8 text — which is why modern tooling can almost always read old ASCII files without conversion.
5.Avoiding Encoding Bugs
Most encoding bugs come from decoding bytes with the wrong encoding — the cause of mojibake (garbled text like é instead of é). To stay safe, declare UTF-8 everywhere: in HTML via <meta charset="utf-8">, in HTTP headers, in your database, and in file formats. When transferring text between systems, convert explicitly rather than relying on auto-detection. You can inspect how any string is encoded at the byte level using our text to Unicode converter.
Try the tools
Run these conversions and checks instantly in your browser — no data leaves your device.
Frequently Asked Questions
Is Unicode the same as UTF-8?
No. Unicode is the standard that assigns code points to characters, while UTF-8 is one specific encoding that serializes those code points into bytes. UTF-8 is the most common encoding of Unicode text.
Does ASCII still exist in modern computing?
Yes — the first 128 Unicode code points are exactly ASCII, and ASCII text is valid UTF-8. ASCII remains useful for protocol headers, configuration, and any data that must be English-only and byte-safe.
Why does the same text have different byte sizes?
Because UTF-8 uses one to four bytes per character. ASCII characters use one byte, accented characters use two, CJK characters use three, and emoji use four.
What causes mojibake and how do I fix it?
Mojibake happens when bytes encoded as one character set (like UTF-8) are decoded as another (like Latin-1). Re-encoding the corrupted text with the correct original encoding usually restores it. Standardizing on UTF-8 prevents the problem.
More comparisons
Explore side-by-side guides for other developer tools and formats.
View all comparisons