Developer and Text Tools

How to Create Dummy Files of an Exact Size for Upload Testing

Test upload limits with valid PDF, image, video, audio, CSV and ZIP files of an exact byte size, including one byte under and over the limit.

Saizul Amin
Saizul Amin5 Nov 2026 · 3 min read
How to Create Dummy Files of an Exact Size for Upload Testing

Every application that accepts uploads has rules: a maximum size, a list of allowed types, perhaps a page limit for PDFs or a duration limit for audio. Testing those rules properly means having files that sit right at the edges. A 10 MB limit should accept a file of exactly 10 MB and reject one a single byte larger. Searching for such files online is slow, and simply padding a file with random bytes produces something that fails type validation because it is no longer a valid PDF or image.

Valid files with exact sizes

Most file formats have a place where extra data is allowed and ignored by readers. The trick is to build a small but complete file and then add exactly the right amount of filler in that place.

  • PDF. A real document with text pages, plus an unused stream object that holds the filler. Viewers never display it.
  • PNG. A test-card image with an extra private chunk before the end marker. Image decoders skip chunks they do not know.
  • JPG. The same test card with comment segments after the start marker, each holding up to about 64 KB.
  • MP4. A short H.264 video made in the browser, followed by a free box that players skip.
  • MP3. Silent audio frames; the number of frames follows the size, and the tag at the start absorbs the last few bytes.
  • WAV, CSV, JSON, TXT and ZIP. Each has its own clean way to reach the exact size, from a JUNK chunk in WAV to trailing spaces in JSON and a stored filler file inside the ZIP.

Making the files

Open the Dummy Test File Generator, choose a file type and enter a size, or tap a quick size such as 1, 5, 10 or 25 MB. Decide whether a megabyte means 1,000,000 bytes or 1,048,576 bytes. Web forms and storage vendors usually use the first, while settings such as PHP's upload_max_filesize and Nginx's client_max_body_size use the second, so 5M there means 5,242,880 bytes.

The content options depend on the type: image width, height and random noise, JPEG quality, video length, number of PDF pages, the kind of text, the sound in a WAV file, and whether padding is zeros, random bytes or repeating text. Zeros compress to almost nothing, which matters if anything between the browser and the server compresses the upload. Random bytes do not compress, so the bytes on the wire match the file size.

Press the button and the file goes straight to your downloads. The list underneath shows the byte size, whether it hit the target exactly and a SHA-256 checksum, which lets you confirm that the server stored exactly what you sent.

The limit tester

Turn on the limit tester and the generator makes three files at once: one byte under your limit, exactly at it, and one byte over. Upload all three. The first two should succeed and the third should be rejected with a clear message. If the second fails, your limit check uses greater-than-or-equal where it should use greater-than. You can also enter a list of sizes, such as 1, 5, 10 and 50, to test progress bars and timeouts with several files.

Other useful tests

  • Rename a valid PNG to .pdf to check whether the server looks at the content or only the extension.
  • Upload a 500-page PDF to test page-count limits and preview generation.
  • Upload a large random-filled ZIP to check how your system handles files that cannot be compressed.
  • Use the CSV and JSON files, which contain fake people with example.com email addresses, to test importers without touching real personal data.

Practical limits

Everything is built in your browser's memory, so files are limited to 2 GB, and phones may refuse much smaller sizes. The MP4 option needs a browser with WebCodecs or uses a slower fallback encoder, and the MP3 is silent by design. Nothing is uploaded while the files are being made.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages