UTF-8 Encoder/Decoder – Text, Bytes, and Hex
Encode text to UTF-8 bytes or hex, decode UTF-8 byte arrays and hex strings back to text, with Unicode normalization and tolerant decoding options.
Tool Purpose & Audience
The UTF-8 Encoder/Decoder converts text to its UTF-8 byte representation — expressed as decimal bytes, hex bytes, or percent-encoded sequences — and decodes UTF-8 byte arrays or hex strings back to readable text. It reveals exactly how text is stored and transmitted at the binary level.
Software developers, network engineers, security researchers, and students learning about character encoding use this tool to inspect how Unicode text maps to bytes, debug encoding issues in APIs, analyse protocol data, and verify that multi-byte characters (emoji, CJK characters, accented letters) encode and decode correctly.
Real-World Use Cases
- Debugging encoding issues in APIs: When an API returns garbled text or question marks instead of special characters, encode the expected text to UTF-8 bytes here and compare with what the API is actually returning to diagnose where the encoding mismatch occurs.
- Understanding multi-byte characters: ASCII characters encode to one byte in UTF-8; most Latin accented characters encode to two bytes; CJK characters (Chinese, Japanese, Korean) encode to three bytes; emoji encode to four bytes. Paste characters to see exactly how many bytes they consume.
- URL encoding analysis: HTTP percent-encoding (%C3%A9 for "é") is just UTF-8 bytes written in hex with % prefixes. Use this tool to understand what any percent-encoded URL segment means in plain text.
- Protocol and file format debugging: Binary protocols, file headers, and network packets often contain UTF-8 encoded strings. Paste the hex bytes from a hex dump here to read the text they represent.
Practical Input → Output Examples
1. ASCII text encoding
Input: "Hello"
UTF-8 Bytes (hex): 48 65 6C 6C 6F
ASCII characters map directly to single bytes — H is 0x48 (72 decimal), e is 0x65 (101 decimal). This 1:1 mapping is why UTF-8 is backward-compatible with ASCII.
2. Multi-byte character encoding
Input: "é" (U+00E9, Latin small letter e with acute)
UTF-8 Bytes (hex): C3 A9 (2 bytes)
Characters outside ASCII (code points U+0080 to U+07FF) encode to 2 bytes in UTF-8 — this is why a French or Spanish word with accents takes more space than an ASCII-only English word.
3. Emoji encoding
Input: "😀" (U+1F600)
UTF-8 Bytes (hex): F0 9F 98 80 (4 bytes)
Emoji and most characters outside the Basic Multilingual Plane encode to 4 bytes in UTF-8. This is why databases that store emoji need a utf8mb4 charset in MySQL — the older utf8 only supports 3-byte characters.
Common Mistakes & Misunderstandings
UTF-8 is not the only Unicode encoding: Unicode is the character set standard; UTF-8 is one encoding of it (others include UTF-16 and UTF-32). UTF-8 is the dominant encoding on the web, but Windows systems historically used UTF-16, which is why Notepad's "ANSI" files sometimes have encoding issues when opened on other systems.
Character count ≠ byte count: A string's "length" in JavaScript counts UTF-16 code units, not bytes. An emoji "😀" has `.length === 2` in JavaScript (it's a surrogate pair) but encodes to 4 bytes in UTF-8. When allocating database columns or buffers by character count, always account for multi-byte encoding.
The BOM (Byte Order Mark): UTF-8 files sometimes start with the sequence EF BB BF — the UTF-8 BOM. While technically valid, the BOM is invisible in editors but can break parsers, shell scripts, and API responses that don't expect it. The BOM is unnecessary in UTF-8 (unlike UTF-16 where it signals byte order) and should generally be avoided.
UTF-8 and UTF-8mb4 in MySQL: MySQL's original utf8 charset only stores 3-byte UTF-8 sequences. To store emoji (4-byte sequences), you must use utf8mb4. This is one of the most common database encoding mistakes — attempting to insert emoji into a utf8 column produces a silent truncation or error.
What is UTF-8 and how does it encode text?
UTF-8 is a variable‑length character encoding for Unicode. ASCII characters use 1 byte; other characters use 2–4 bytes depending on their code point.
For example: "A" → 41 (hex) / 65 (decimal), and "€" → E2 82 AC (hex) / 226,130,172 (decimal). It is the most widely used web encoding because it is compact, backward‑compatible with ASCII, and robust across systems.
How do I convert text to UTF-8 bytes or hex?
Select an encode mode (Text → UTF‑8 Hex or Text → UTF‑8 Bytes). Paste your text; the tool outputs UTF‑8 bytes as either hex pairs or decimal values.
Example: "Hi" → Hex: 48 69, Bytes (decimal): 72,105. You can choose separators (spaces, commas, or new lines) to suit your workflow.
How do I decode UTF-8 hex or decimal byte sequences back to text?
Pick a decode mode (UTF‑8 Hex → Text or UTF‑8 Bytes → Text). Paste your bytes; spaces, commas, and new lines are all accepted and automatically parsed.
Examples: E2 82 AC → "€". 226,130,172 → "€". The tool reconstructs the original text with a UTF‑8 decoder.
What does “tolerant decode” do?
Tolerant decode replaces invalid or incomplete byte sequences with the replacement character (�, U+FFFD) instead of throwing an error. Enable it when your input may contain mistakes, truncation, or mixed formats.
Disable it (strict mode) to surface and validate errors in malformed data.
What are Unicode normalization forms (NFC and NFD)?
Normalization makes equivalent Unicode sequences consistent.
NFC composes characters (e.g., "é" is a single code point). NFD decomposes them (e.g., "e" + "́"). Use normalization to ensure consistent storage, comparison, and display across systems that may treat composed and decomposed forms differently.
How are separators and whitespace handled in byte input?
You can separate bytes with spaces, commas, or new lines—multiple separators are automatically collapsed. Hex input should be provided as pairs (e.g., E2 82 AC). Decimal input can be comma‑separated (e.g., 226,130,172) or line‑separated.
Can I inspect Unicode code points for the result?
Yes. Enable “Show code points” to see a list like U+0041 U+20AC for the current output. This helps debug exact characters and combining marks.