Generate corrupted files for testing your application's error handling and file validation. This tool creates files with correct file type headers (magic bytes) but corrupted content - perfect for testing how your upload handlers, file parsers, and validation logic deal with malformed files. Choose from common file types (PDF, DOCX, XLSX, JPG, PNG, MP4, and more), set the corruption level, and download the test file instantly.
Generate dummy corrupted files for testing purposes. These files have the correct file extension (and optionally correct magic bytes in the header) but contain invalid data. Useful for testing file upload validation, error handling in file parsers, recovery workflows, and content-type detection.
.pdf | Magic bytes: 0x25 0x50 0x44 0x46 0x2DEffective size: 1.0 KB
Select a file type from the dropdown (PDF, DOCX, XLSX, PPTX, ZIP, JPG, PNG, MP4, MP3, CSV, XML, JSON, TXT, GIF). Choose a file size (1KB, 10KB, 100KB, 1MB, or enter a custom size). Select a corruption level: 'Header only' creates a file with correct magic bytes followed by random data, 'Random bytes' generates completely random data with the correct extension, or 'Truncated' creates a file with correct headers that abruptly ends. Click 'Generate' to create the file and 'Download' to save it.
Corrupt file generation is essential for: testing file upload validation in web applications, verifying error handling in file parsing libraries, QA testing to ensure applications gracefully handle malformed input, testing antivirus and security scanner behavior, validating MIME type detection logic, testing file recovery and repair tools, ensuring backup systems handle corrupted files correctly, testing CDN and storage service behavior with invalid files, and automated testing pipelines that need predictable bad input data.
Each file type has specific magic bytes (file signatures) that identify it: PDF starts with %PDF- (0x25504446), ZIP/DOCX/XLSX start with PK (0x504B0304), PNG has an 8-byte signature (0x89504E47...), JPEG starts with 0xFFD8FFE0, and MP3 with ID3 (0x494433). The tool constructs a Uint8Array with these correct header bytes followed by cryptographically random data from crypto.getRandomValues(). The 'Truncated' mode adds partial valid-looking data after the header before abruptly ending. Files are created as Blobs with the correct MIME type for realistic testing.
Corrupted files are essential for testing. When building file upload features, you need to verify that your application gracefully handles malformed input - showing user-friendly error messages instead of crashing. This tool generates predictable test files so you can verify every error path.
The file starts with the correct magic bytes (file signature) for the selected type, making it appear as a valid file to basic MIME detection, but the rest of the content is random garbage data. This tests whether your application validates beyond just the file header.
Yes. The files contain only random bytes - they cannot execute code or harm your system. They are purely for testing file handling logic. However, some antivirus software may flag files with mismatched headers and content.
Generate and verify time-based one-time passwords (TOTP) for two-factor authentication.
Randomize, shuffle, sort, and pick random items from any list. Fisher-Yates algorithm with true randomness.
Generate clean, SEO-friendly URL slugs from any text with transliteration support.
Transform, format, generate, and encode data instantly. Private, fast, and always free.
Browse All Tools