UTF-8 Encoder & Decoder
Convert text to UTF-8 hex, decimal, binary, escaped, or URL-encoded bytes and decode them back
Paste text and get its UTF-8 byte sequence in hex, decimal, binary, escaped, or URL-encoded format — or go the other direction and decode raw bytes back into readable characters. The per-character breakdown table shows exact code points and byte counts, which saves real time when you're tracking down encoding bugs. And everything runs in your browser. Nothing gets uploaded.
How It Works
In encode mode, each character gets converted to its UTF-8 byte sequence using JavaScript's built-in TextEncoder. You pick whether you want those bytes shown as hex, decimal, binary, backslash-escaped, or percent-encoded. Decode mode does the reverse — feed it bytes in any of those formats and it reconstructs the original text. The character breakdown table shows every single character's code point and how many bytes it takes up.
Examples
Encoding a Mixed-Language String
You're storing multilingual user input and need to see the raw bytes that go into the database.
Hello 世界
48 65 6C 6C 6F 20 E4 B8 96 E7 95 8C
Decoding Escaped Bytes from a Log File
Your server log shows \xC3\xA9 instead of the actual character. Flip to decode mode and paste it in.
\xC3\xA9
é
Checking Emoji Byte Length for a Database Column
Your VARCHAR(4) column keeps rejecting emoji inserts. Encoding the emoji shows exactly why — a single emoji takes 4 bytes in UTF-8, but some take more when they use ZWJ sequences.
🚀
F0 9F 9A 80 (4 bytes)
Who Uses This
Debugging mojibake — those garbled characters that show up when encoding headers are wrong.
Checking byte lengths before setting column sizes for multilingual data.
Inspecting URL-encoded payloads and verifying how special characters get encoded in requests.
Learning how characters map to bytes — much faster than doing the binary math by hand.
Common Mistakes
The string "café" is 4 characters but 5 bytes in UTF-8 because é takes 2 bytes. If your code counts bytes when it should count characters (or vice versa), you'll get truncation bugs. Always check which one your function measures.
If you paste 48656C6C6F as one blob, the decoder might not know where one byte ends and another starts. Separate bytes with spaces or use the escaped format (\x48\x65\x6C\x6C\x6F) instead.
JavaScript strings are internally UTF-16. That means "Hello".length returns 5 (UTF-16 code units), but certain emoji like 🚀 report .length === 2 because they use a surrogate pair. The actual UTF-8 byte count for that emoji is 4. These are three different numbers for the same character.
Technical Details
- Processing: 100% client-side — uses the browser's native TextEncoder/TextDecoder API
- Browser Support: Chrome, Firefox, Safari, Edge (all versions from 2018+)
- Character Support: Full Unicode range — U+0000 to U+10FFFF (1,114,112 code points)
- Output Formats: Hex, Decimal, Binary, Escaped (\xHH), URL-encoded (%HH)
Frequently Asked Questions
What is UTF-8 encoding?
UTF-8 is a way of turning Unicode characters into bytes. It uses 1 byte for plain English letters (same as ASCII), 2 bytes for accented characters and Cyrillic, 3 bytes for Chinese/Japanese/Korean, and 4 bytes for emoji. Over 98% of web pages use UTF-8 — it's basically the default encoding for the internet.
How do I fix UTF-8 encoding problems?
First, figure out what you're actually looking at. Paste the garbled text into this tool's decode mode — if it produces readable output, you know the bytes are correct but your display is using the wrong encoding. Most encoding bugs come from mismatched headers: the data is UTF-8 but something in the chain declares it as Latin-1 or Windows-1252. Fix the Content-Type header or charset declaration and the problem usually goes away.
What is the difference between UTF-8 and Unicode?
Unicode is the catalog — it assigns a number (code point) to every character. UTF-8 is one way to store those numbers as bytes. Think of Unicode as the phone book and UTF-8 as the way phone numbers are dialed. There are other encodings like UTF-16 and UTF-32, but UTF-8 won the web.
Is my data safe when using this tool?
Yes. All encoding and decoding happens right in your browser using JavaScript. Nothing gets sent to any server. You can verify this yourself — open your browser's Network tab and watch. Zero requests go out when you encode or decode text.
How many bytes does an emoji take in UTF-8?
A basic emoji like 😀 takes 4 bytes. But composite emoji — the ones made from multiple characters joined with a zero-width joiner — can be much larger. The family emoji (👨👩👧👦) is actually 25 bytes because it's four separate emoji glued together with ZWJ characters. That's why database columns set to 4 bytes sometimes reject emoji.