Generate Invalid UTF8
Create UTF8 that has invalid byte sequences in it. Runs entirely in your browser, so your data never leaves your device.
Runs on your device, nothing uploaded
Output
Generating…
This runs entirely on your device
Generate Invalid UTF8 is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. Nothing is requested from a server, so the result you see has never existed anywhere but here.
- No server involved
- Generated on your device
- Works offline once loaded
- Nothing stored or logged
How to use Generate Invalid UTF8
- 1. Set how many bad sequences. Tap 5, 20 or 100, or type a number up to 1000. Each sequence is one invalid UTF-8 test vector.
- 2. Choose the kinds. Untick the kinds you do not want: lone continuation bytes, overlong encodings, truncated characters, encoded surrogates, invalid bytes such as FE and FF, and sequences above U+10FFFF. Annotated view lists every sequence with its kind and why a decoder must reject it.
- 3. Pick an output format and copy. Output format writes hex, decimal, \x escapes, a C array or a Python b'' literal, with your Separator for hex and decimal. Copy always takes the bytes; Validate UTF8 under the result checks them with the bytes carried over.
When to use Generate Invalid UTF8
Generate Invalid UTF8 produces byte sequences that break the UTF-8 encoding rules on purpose, things like lone continuation bytes and overlong encodings. Every text-handling library needs to be tested against inputs like this to make sure it fails safely instead of crashing or silently accepting garbage.
- Writing a decoder's negative test suite. You are implementing a UTF-8 decoder and need known-bad byte sequences to confirm it rejects them with the right error rather than throwing an unhandled exception or producing garbage output.
- Fuzzing a network protocol parser. A protocol parser reads UTF-8 strings off the wire and you want to check it survives malformed input from a misbehaving or malicious client without crashing the service.
- Demonstrating an overlong encoding exploit. You are writing security documentation about why overlong UTF-8 sequences were historically used to smuggle characters past input filters, and need real example bytes to illustrate the point.
Examples
Five invalid byte sequences
One possible result
c0 80 ff e2 82 ed a0 80 80
About the Generate Invalid UTF8 tool
Generate Invalid UTF8 is a free online tool that works entirely inside your web browser. Create UTF8 that has invalid byte sequences in it. Because the processing happens on your own device, nothing you enter is uploaded, logged or stored anywhere.
This page is one of 69 UTF-8 utilities on EditSafely. Each one does a single job well, and all of them follow the same rule: your input stays on your machine.
You can shape the output with 10 settings, including How many bad sequences, View, Lone continuation and Overlong, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.
Because nothing leaves your device, the tool is suitable for sensitive content such as internal documents, credentials or customer data. It also responds instantly, since every step is handled on your own machine rather than by a remote API.
Frequently asked questions
Does Generate Invalid UTF8 cost anything?
Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.
Does the generator send anything to a server?
No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.
How do I get a different result?
Press the button under the result to generate again. Each run is computed fresh on your device, and any options you change are applied to the next result immediately.
Do I need to sign up or install anything?
Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.
How do I use the result?
The output panel has a one-click Copy button, and Download saves the result as a file.
Related tools
All UTF-8 Tools →Validate UTF8
Check UTF8 encoding for errors and report them.
Debug UTF8
Split UTF8 data into byte sequences and visualize them.
Convert Hexadecimal to UTF8
Quickly convert hex numbers to UTF8 characters.
Introduce Errors in UTF8
Randomly flip bits and insert invalid continuation bytes.
Generate Random UTF8
Quickly generate random UTF8 data.