Corrupt File Generator

Make broken copies of a file to test how your app, upload form or parser handles damaged input. Everything runs in your browser and your original file stays unchanged.

How to Create a Corrupted File

  1. Choose Use my file and drop any file into the box, or choose Generate a sample and pick a file type.
  2. Pick how the file should be damaged, for example Truncated or Damaged header.
  3. Click Create Corrupted File, then download the result. Run it again for a new random variant.

Five Ways to Corrupt a File

  • Truncated: only the first half of the file is kept, like a download or upload that stopped midway.
  • Damaged header: the first 16 bytes are replaced with random data. That breaks the file signature that apps use to recognize the format.
  • Random bytes: about 1% of the file is overwritten with random data in 32 places. The start of the file stays intact, so the format is still recognized and the damage shows up only while the file is read.
  • Wrong extension: the content stays exactly the same, but the file gets a different extension, for example a PDF saved as .docx.
  • Empty file: a file with the same name and 0 bytes of content.

What Corrupted Test Files Are Good For

Real users upload broken files all the time: interrupted downloads, files renamed by hand, damaged storage. A corrupted test file shows whether your software rejects them with a clear message or crashes, hangs or stores garbage.

  • Upload forms: check that type and size validation catch empty files and files with a misleading extension.
  • Parsers and importers: make sure a truncated PDF, ZIP or spreadsheet produces an error instead of an endless loop.
  • Image pipelines: see how thumbnails and resizers react to an image with damaged data.
  • Security reviews: confirm the server checks file content and not just the extension.

Sample Files

If you don't have a file at hand, choose Generate a sample. FileMock creates a small, valid PDF, DOCX, XLSX, ZIP, JPG or PNG with the same generators as the FileMock test file generator, and then applies the corruption you picked.

Limitations

  • The result depends on the app that opens the file. Some apps repair minor damage, and many image viewers show a partly broken image instead of an error.
  • Random bytes are random: two runs damage different places, and a run can hit a part of the file that the app never reads.
  • The tool doesn't encrypt or password-protect files. It only damages or renames them.

Corrupt File Generator FAQ

Answers to common questions about creating corrupted test files.

Related Tools