Charset & Encoding Reference
Reference of common character sets plus a live UTF-8 encoder — type text and see code points, bytes, and percent-encoding.
Learn how text becomes bytes: type anything and watch its Unicode code points, UTF-8 byte values, and percent-encoded form update live. The reference table covers UTF-8, UTF-16 variants, ASCII, Latin-1, Windows-1252, and more. Useful for debugging mojibake and understanding URL encoding.
Characters & code points
4
U+0063 U+0061 U+0066 U+00E9
UTF-8 bytes
5
63 61 66 C3 A9
Percent-encoded
%63%61%66%C3%A9
ASCII characters use 1 byte; accented letters use 2; most CJK characters use 3; emoji use 4.
Common character sets
| Charset | Description | Note |
|---|---|---|
| UTF-8 | Variable-length Unicode encoding using 1 to 4 bytes per character. | The dominant encoding of the web; backwards compatible with ASCII. |
| UTF-16 | Variable-length Unicode encoding using 2 or 4 bytes per code unit. | Used internally by JavaScript, Java, and Windows APIs. |
| UTF-16BE | UTF-16 with fixed big-endian byte order and no byte-order mark. | Byte order is defined by the encoding name, so no BOM is needed. |
| UTF-16LE | UTF-16 with fixed little-endian byte order and no byte-order mark. | Common on Windows and little-endian (x86) systems. |
| UTF-32 | Fixed-length Unicode encoding using exactly 4 bytes per character. | Simple to index but wasteful; rarely used in files. |
| ASCII | 7-bit encoding of 128 characters: English letters, digits, punctuation, and control codes. | Every byte starts with a 0 bit; UTF-8 is a strict superset of ASCII. |
| ISO-8859-1 (Latin-1) | 8-bit encoding covering Western European languages. | Its first 256 code points map one-to-one onto Unicode. |
| Windows-1252 | Superset of Latin-1 that was the default encoding on Western Windows systems. | Adds printable characters such as smart quotes in the 0x80–0x9F range. |
| GB18030 | Chinese national standard encoding that covers all Unicode characters. | Mandatory for software sold in China. |
| Shift_JIS | Legacy Japanese encoding for half-width and full-width characters. | Still found in older Japanese systems and email. |
How to use this calculator
- Type or paste any text into the input box.
- Read the character count and Unicode code points (U+XXXX) for each character.
- Read the UTF-8 byte count and the raw byte values in hexadecimal.
- Copy the percent-encoded form for use in URLs and query strings.
- Scroll down to browse the charset reference table for background.
Worked example
Typing cafe with an accent on the e shows 4 characters but 5 UTF-8 bytes — 99, 97, 102, 195, 169 — because that e (U+00E9) needs two bytes (C3 A9). Its percent-encoded form is the byte-faithful %63%61%66%C3%A9.
Frequently Asked Questions
What is UTF-8?
UTF-8 is a variable-length encoding for Unicode that uses 1 to 4 bytes per character. Plain ASCII text encodes as a single byte per character, which is why UTF-8 is backwards compatible with ASCII — every valid ASCII file is automatically valid UTF-8. It is the dominant encoding of the web and the default you should choose for new projects.
Why does the word cafe with an accent take 5 bytes for 4 characters?
Because characters and bytes are different things in UTF-8. The letters c, a, and f are ASCII and take 1 byte each, but the accented e is U+00E9, which needs 2 bytes: C3 A9. So 4 characters become 5 bytes: 99, 97, 102, 195, 169. This is why string length in characters and in bytes disagree for any non-ASCII text — type it into the encoder above to see it happen live.
What is mojibake and how do I fix it?
Mojibake is garbled text that appears when bytes encoded in one charset are decoded with another — for example UTF-8 bytes read as Latin-1. The fix is to make the encoding explicit and consistent: declare UTF-8 in your HTML meta charset tag, your HTTP Content-Type header, and your database connection. When you control both ends, mojibake simply cannot happen.
What is percent-encoding (URL encoding)?
Percent-encoding represents each UTF-8 byte as a percent sign followed by two hexadecimal digits. URLs may only contain a limited ASCII set, so anything else — spaces, accented letters, emoji — must be encoded this way in query strings and path segments. The encoder above shows the byte-faithful form where every byte is escaped, which is exactly what travels over the wire.
When would I use UTF-16 instead of UTF-8?
Rarely by choice — mostly you encounter it because a platform chose it for you. JavaScript strings, Java, .NET, and Windows APIs all use UTF-16 internally, which is why emoji count as two characters in JavaScript's length property. For files, network protocols, and storage, UTF-8 wins on size and compatibility; UTF-16 variants persist mainly in legacy Windows formats and in-memory runtimes.