UTF8 decoding is the reverse of UTF-8 encoding: it turns bytes representing Unicode scalar values into text, with each scalar encoded in one to four bytes and malformed sequences rejected by a strict decoder.
For a beginner, the central distinction is simple: UTF-8 describes how characters become bytes, while decoding describes how known UTF-8 bytes become characters again. A byte sequence has no visible meaning until the correct encoding is specified.

The core idea behind UTF8 decode
Unicode assigns code points to characters. UTF-8 then transforms each valid Unicode scalar value into a sequence of one to four bytes. A decoder reverses that transformation instead of guessing which bytes belong together. The byte-range restrictions are defined in RFC 3629, while the Unicode scalar-value rules are covered in Unicode Core Specification, Chapter 3.
| Term | Meaning during UTF-8 decoding |
|---|---|
| Unicode scalar value | A valid Unicode code point that UTF-8 can represent. Surrogate code points are excluded, and the highest permitted value is U+10FFFF. |
| UTF-8 byte | One byte in the encoded sequence. A single character can occupy one, two, three, or four of them. |
| UTF-16 code unit | A 16-bit unit used by JavaScript strings. It is not the same as a UTF-8 byte, and a supplementary character commonly uses two code units. |
| Hex, decimal, and binary | Different display notations for the same byte array. Changing the notation does not change the underlying UTF-8 sequence. |
ASCII characters keep their familiar one-byte values. A supplementary character such as an emoji can require four UTF-8 bytes even though it is one Unicode scalar value and may occupy two JavaScript UTF-16 code units. This difference explains why a decoder may report bytes in one operation and code points in another.
How UTF-8 signals byte length
The first byte of a UTF-8 sequence reveals how many bytes belong to that scalar value. Continuation bytes begin with the pattern 10xxxxxx. Once the decoder reads the leading byte, it knows where the complete character should end.
| Leading-byte pattern | Bytes used | Unicode scalar range |
|---|---|---|
| 0xxxxxxx | 1 byte | U+0000–U+007F |
| 110xxxxx | 2 bytes | U+0080–U+07FF |
| 1110xxxx | 3 bytes | U+0800–U+FFFF, excluding surrogates |
| 11110xxx | 4 bytes | U+10000–U+10FFFF |
This structure lets a decoder join bytes correctly without assuming that one byte equals one visible character. It also gives the decoder enough information to detect a missing continuation byte, an invalid leading byte, or a sequence that violates the UTF-8 rules.
Decode one small sample
Take a hexadecimal source containing E2 82 AC. The first byte, E2, has a 1110xxxx leading pattern, so it starts a three-byte sequence. The next bytes, 82 and AC, are continuation bytes. Under UTF-8, this complete sequence represents the euro sign, U+20AC, so the decoded output is €.
Now perform a round-trip check: encode that euro sign again using hexadecimal notation. The exact result should be E2 82 AC. Comparing the original and returned byte values confirms that the decode did not silently substitute, truncate, or transform the character. If the bytes differ, inspect the notation and direction before treating either result as reliable.
Match bytes to the source notation
Choose the notation that matches the source rather than converting the data by guesswork. Each notation has strict formatting rules, and changing the display format does not alter the byte array.
| Notation | Accepted decoder input | Output format |
|---|---|---|
| Hexadecimal | One continuous even-length string, or space- or comma-separated one- or two-digit byte tokens. Optional 0x prefixes are accepted on separated tokens. | Uppercase two-digit bytes separated by spaces. |
| Decimal | Integer tokens only, with each byte value in the range 0–255. | Values from 0 through 255 separated by spaces. |
| Binary | Tokens containing exactly eight characters, each of which must be 0 or 1. | Exactly eight bits per byte. |
For example, a comma-separated hexadecimal source may return space-separated output because the tool uses a consistent display format. Compare the represented byte values rather than relying only on punctuation. UTF-8 is also not Base64, URL percent encoding, an HTML entity, or a hexadecimal number; data in one of those formats needs its appropriate decoder before UTF-8 decoding can begin.
Decode bytes without silent replacement
For a browser-based first pass, the UTF-8 Encoder / Decoder converts locally and uses fatal malformed-input checks, making it suitable for a short sample and verification workflow.
- Preserve the original source and begin with a short sample whose expected content you already know.
- Choose UTF-8 bytes to text, because decoding means turning byte notation back into Unicode text.
- Select hexadecimal, decimal, or binary to match the source representation.
- Paste the bytes while following the selected notation rules exactly. For hexadecimal, use a continuous even-length string or properly separated tokens; for binary, keep every token at eight bits.
- Select the conversion button and wait for the result panel to show the decoded text or an explicit error.
- Compare the output with the expected content. Then switch to text-to-byte conversion, use the same notation, encode the result, and compare the returned byte values with the original before replacing any data.
Depending on the selected direction, the result panel reports bytes or code points. Empty input is valid and decodes to empty text, but an empty result is not by itself proof that a non-empty source was preserved. The round trip remains the decisive check.
Interpret malformed-input errors
A strict UTF-8 decoder refuses damaged sequences rather than presenting replacement characters as verified text. An explicit error can indicate a problem with the bytes, the notation, or the assumption that the source uses UTF-8.
- An overlong sequence uses more bytes than necessary for the same scalar value.
- A truncated sequence ends before all required continuation bytes arrive.
- An isolated continuation byte appears where a leading byte is required.
- A surrogate encoding represents a value that UTF-8 does not permit.
- A sequence encodes a value above the maximum scalar value, U+10FFFF.
When the source is JavaScript text
JavaScript strings can also contain unpaired UTF-16 surrogate code units. During text encoding, the tool rejects these fragments before calling the browser encoder, which would normally replace them with U+FFFD. Valid surrogate pairs representing supplementary characters are accepted. If encoding fails because of an unpaired surrogate, inspect the source string rather than changing the output notation.
The converter assumes UTF-8 and does not auto-detect legacy encodings such as Windows-1252, Shift JIS, GBK, or ISO-8859 families. If valid text for the intended source fails to decode, identify the source encoding instead of forcing legacy bytes through UTF-8.
Know the size and privacy limits
Text input is bounded at 200,000 UTF-16 code units, while decoded notation is bounded at 200,000 bytes. The converter does not stream large files or accept uploads, so use a dedicated binary tool for larger data. Starting with a short known sample also makes malformed boundaries and notation mistakes easier to identify.
All text and bytes remain in the current tab. Nothing is uploaded, logged, stored, normalized, translated, escaped for another context, or copied automatically. The processing uses the browser’s standard text encoder and a fatal UTF-8 decoder, so the output is produced locally without silently repairing malformed input.
Preserve the original data, select the correct notation, inspect the byte boundaries, and complete a round trip before replacing an unknown source. That sequence keeps a beginner workflow simple: establish what the bytes should mean, decode strictly, compare the result, and only then use the converted output.
For a deeper look, see Base32 Decode in PHP: RFC 4648 Workflow.
For a deeper look, see Base58 Decode Solana Values and Verify Raw Bytes.