UTF-8 Encoder / Decoder
Convert Unicode text to well-formed UTF-8 bytes or strictly decode byte sequences without silent replacement.
Privacy: your files never leave your device. All processing happens locally in your browser.
How to use
- 1.Choose Text to UTF-8 bytes or UTF-8 bytes to text, then select hexadecimal, decimal, or binary notation.
- 2.Enter Unicode text or strictly formatted byte tokens and select the conversion button.
- 3.Compare the exact output with the source format and verify a round trip before replacing original data.
About UTF-8 Encoder / Decoder
UTF-8 Encoder / Decoder converts between Unicode text and UTF-8 bytes entirely in the browser. Encode text to hexadecimal, decimal, or binary byte notation, or decode one of those notations back to text. The converter uses the browser’s standard TextEncoder and a fatal TextDecoder, so malformed input is rejected instead of quietly replaced.
UTF-8 is a variable-width Unicode encoding standardized by Unicode and RFC 3629. Valid Unicode scalar values use one through four bytes. ASCII code points retain their one-byte values, while larger values use leading and continuation-byte patterns. The permitted scalar range ends at U+10FFFF and excludes UTF-16 surrogate code points.
Eight external anchors cover dollar sign U+0024 as 24, A as 41, cent sign U+00A2 as C2 A2, euro sign U+20AC as E2 82 AC, grinning face U+1F600 as F0 9F 98 80, the U+007F boundary, the U+0800 boundary, and maximum scalar U+10FFFF as F4 8F BF BF. Both encoding and decoding tests use these values.
Hexadecimal output uses uppercase two-digit bytes separated by spaces. Decimal output uses values from 0 through 255 separated by spaces. Binary output uses exactly eight bits per byte. These are display representations of the same byte array; changing the representation does not change the underlying UTF-8 sequence.
Hex decoding accepts space- or comma-separated one- or two-digit byte tokens, optional 0x prefixes on separated tokens, or one continuous even-length hexadecimal string. Decimal input accepts integer tokens only. Binary input requires exactly eight zero-or-one characters per token. Empty input decodes to empty text.
The decoder is fatal. Overlong encodings such as C0 AF, truncated sequences such as E2 82, isolated continuation bytes, surrogate encodings, and values above U+10FFFF fail with an explicit error. This avoids presenting replacement characters as if they were verified original text.
Text encoding also checks for unpaired UTF-16 surrogate code units before calling TextEncoder. JavaScript strings can contain these ill-formed fragments, and the platform encoder would normally replace them with U+FFFD. The tool rejects them so a claimed lossless conversion does not silently change input. Valid surrogate pairs representing supplementary characters are accepted.
Input is bounded at 200,000 UTF-16 code units for text and 200,000 bytes for decoded notation. These limits constrain memory, token parsing, output size, and interface work. The converter does not stream large files or accept uploads; use a dedicated binary tool for large data.
UTF-8 bytes are not the same as Unicode code points, UTF-16 code units, HTML entities, URL percent encoding, Base64, hexadecimal numbers, encryption, or compression. A four-byte emoji is one Unicode code point but four UTF-8 bytes and typically two JavaScript UTF-16 code units. The result panel reports bytes or code points according to the operation.
A byte sequence has no visible meaning without knowing its encoding. This page assumes UTF-8 only and does not auto-detect legacy encodings such as Windows-1252, Shift JIS, GBK, or ISO-8859 families. If legacy bytes fail, identify the original encoding rather than forcing them through UTF-8.
All text and bytes remain in the current tab. Nothing is uploaded, logged, stored, normalized, translated, escaped for another context, or copied automatically. For reliable use, start with a short known sample, choose the correct representation, inspect byte boundaries, and verify a round trip. Preserve the original data before converting an unknown source.
Methodology & sources
Bound text and bytes at 200,000 units; reject unpaired UTF-16 surrogates; encode with browser TextEncoder; serialize every byte as uppercase two-digit hex, decimal 0–255, or exactly eight binary digits; parse continuous hex pairs or strict separated tokens; reject out-of-range and malformed notation; decode with TextDecoder('utf-8', {fatal:true}) so overlong, truncated, surrogate, isolated-continuation, and out-of-range sequences fail; normalize nothing and keep all processing local.
Frequently asked questions
- Why does malformed UTF-8 produce an error instead of a replacement character?
- Fatal decoding prevents damaged or non-UTF-8 bytes from being presented as verified original text.
- Can I paste one continuous hexadecimal string?
- Yes, if it contains an even number of hexadecimal digits; separated tokens and optional 0x prefixes are also accepted.
- Is UTF-8 the same as Base64 or URL encoding?
- No. UTF-8 maps Unicode scalar values to bytes; Base64 and percent encoding represent bytes for different transport contexts.
- Why can one character use four bytes?
- UTF-8 is variable width, and supplementary Unicode scalar values such as many emoji require four bytes.
Related tools
- Text to Binary ConverterEncode text as visible 8-bit UTF-8 binary bytes or decode strictly formatted binary back to valid Unicode text.
- Hex to Text ConverterParse hexadecimal bytes with explicit separator and 0x-prefix rules, then decode only complete valid UTF-8 without silent replacement.
- ASCII ConverterConvert standard 7-bit ASCII text to decimal codes or decode decimal codes back to exact ASCII characters locally.
- Base64 Encode / DecodeEncode or decode Base64 instantly with full UTF-8 support — emoji and accents work, all in your browser.
- Base32 Encode / DecodeEncode UTF-8 text to canonical RFC 4648 Base32 or decode padded and unpadded Base32 back to strict UTF-8.
- Binary To TextConvert text to binary and binary back to text instantly, with full Unicode (UTF-8) support and everything running locally in your browser.