Last updated ·Published ·By the WiserWork team
UTF-8 Validator
Check whether a byte sequence is well-formed UTF-8, byte by byte
Paste hex bytes or upload a file and this tool walks the bytes manually against the UTF-8 encoding rules, reporting either "well-formed" or the exact byte index and reason for the first violation.
What is the UTF-8 Validator?
TextDecoder can tell you pass or fail, but not where things went wrong. This tool implements the UTF-8 byte-sequence rules directly: it checks lead-byte ranges, continuation-byte shape, overlong encodings, and the bytes that would encode a UTF-16 surrogate or a code point above U+10FFFF, and it stops at the first byte that breaks any of those rules so you know exactly where to look.
Key Features
- Manual byte-by-byte validation that reports the position of the first bad byte
- Explains which rule was broken — invalid lead byte, bad continuation, overlong encoding, and more
- Accepts pasted hex bytes or an uploaded file's raw bytes
- Highlights the offending byte inline in a hex dump of the input
How It Works
- Paste hex byte pairs, or switch to Upload File and choose a file.
- The tool walks the byte array, checking each lead byte against the UTF-8 rules for how many continuation bytes should follow.
- Continuation bytes are checked for the correct 10xxxxxx shape and legal range.
- The first byte that breaks a rule is reported by index, with a plain-language reason.
A Real-World Use Case
A CSV import or API integration rejects a file with "invalid encoding" and no further detail. Uploading the file here pinpoints the exact byte offset where the sequence breaks, which is usually enough to identify whether the file was actually saved as Latin-1, Windows-1252, or a UTF-8 file with one corrupted section.
Frequently Asked Questions
How does the validator find the exact bad byte?
It walks the byte array manually, following the UTF-8 rules for how many continuation bytes each lead byte requires and which ranges are legal, rather than relying only on TextDecoder's pass/fail result. That lets it report the index of the first byte that breaks the rules and why.
What kinds of errors does it catch?
Invalid lead bytes, continuation bytes that don't start with 10xxxxxx, truncated multi-byte sequences cut off at the end of the input, overlong encodings, and lead bytes that would encode a UTF-16 surrogate or a code point above U+10FFFF.
Can I validate a file instead of typing hex bytes?
Yes — switch to Upload File, choose a file, and the tool reads its raw bytes and runs the same validation. Large files are capped so the byte-by-byte check stays fast in the browser.
Files are read locally with the File API and never uploaded — validation happens entirely on your device.