About UTF-8 Encoder
This is a small text tool that runs entirely in your browser. You paste or type text and pick an option: Text to hex bytes, Text to decimal bytes, Text to \x escapes, Text to code points, Hex bytes to text, or Decimal bytes to text. Developers, QA engineers and data cleaners use it for API payload checks, debugging mojibake and inspecting byte-level output. The tool uses the browser TextEncoder/TextDecoder behavior and the WHATWG UTF-8 algorithm. Nothing you type or paste is uploaded to any server. The output is copyable with one click. Compared with many sites, this tool keeps the interface simple and shows both encoding and decoding modes with common byte formats, so you can test examples fast without configuration.
How to use it
- 1Paste or type text into the input box.
- 2Choose an option: hex, decimal, \x escapes, or code points.
- 3Click Encode or Decode to produce the result.
- 4Click Copy to copy output to your clipboard.
Worked example
Input: café Mode: Text to hex bytes Output: 63 61 66 C3 A9 Explanation: 'c' = 0x63, 'a' = 0x61, 'f' = 0x66, 'é' = U+00E9 -> C3 A9.
How it works
Use the standard UTF-8 encoder rules from WHATWG/RFC 3629.
If code point <= 0x7F: output 1 byte 0xxxxxxx.
If 0x80 <= code point <= 0x7FF: output 2 bytes 110xxxxx 10xxxxxx.
If 0x800 <= code point <= 0xFFFF: output 3 bytes 1110xxxx 10xxxxxx 10xxxxxx.
If 0x10000 <= code point <= 0x10FFFF: output 4 bytes 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx.
Do not emit encodings for surrogate code points U+D800..U+DFFF and avoid overlong encodingsSee WHATWG Encoding Standard and RFC 3629 for exact bit shiftsSource: WHATWG Encoding Standard (UTF-8 encoder)RFC 3629, UTF-8. Last checked 5 November 2026.
What it is good for
- Runs entirely in your browser, nothing is uploaded.
- Supports hex, decimal, \x escapes and Unicode code points.
- One-click copy makes testing and pasting fast.
- No file upload or server processing; everything runs locally in the browser.
- No automatic detection of legacy encodings like Windows-1252; you must provide bytes in supported formats.
Questions people ask
What formats can I convert between?
You can encode text to hex bytes, decimal bytes, \x escape sequences, or Unicode code points. You can also decode hex bytes or decimal bytes back to text.
Does the tool upload my text to a server?
No. All encoding and decoding runs in your browser using built-in APIs. Nothing you type or paste is sent to our servers.
How many bytes does a character use in UTF-8?
UTF-8 uses 1 to 4 bytes. U+0000..U+007F use 1 byte; U+0080..U+07FF use 2 bytes; U+0800..U+FFFF use 3 bytes; U+10000..U+10FFFF use 4 bytes. This follows the WHATWG and RFC 3629 rules.
Can the tool fix mojibake from a legacy encoding?
No. The tool does not auto-detect legacy encodings like Windows-1252. If you know the original bytes, paste them as hex or decimal and decode to text. If you only have misdecoded text, you must recover the original bytes first.
Does the tool add or remove a UTF-8 BOM?
The interface does not insert or strip a BOM automatically. The UTF-8 BOM is optional and is the byte sequence EF BB BF. You can add or remove it manually by editing the byte list.
Are invalid UTF-8 sequences handled?
When decoding, the browser TextDecoder behavior applies. Strict invalid sequences are not accepted per the standard and may be replaced or rejected depending on the runtime. See RFC 3629 for details.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.