Stax

…

Tools

1 MB PDF File — Sample Download, Exact Size

A valid 1 MB sample PDF of exactly 1,048,576 bytes, built in your browser: free, no sign-up, nothing uploaded. Shows which upload limits it meets.

Last updated:

1 MB is the usual first size to try when you test an upload, and 1,048,576 bytes is also the exact default limit of nginx's client_max_body_size. The button below builds a valid PDF of precisely that many bytes, so it is the file to use when you want to see a stock web server reach its limit.

Built on your device in a moment: nothing is uploaded, and no file is hosted. A different size, another file type or a PDF with several pages: test file generator.

The exact file

Size1 MB (1 KB counted as 1,024 bytes)
Exact length1,048,576 bytes
In decimal megabytes1.049 MB
As base64, as sent inside JSON1,398,104 bytes
Pages1 (the rest is unused data that readers skip)
Saved astest-file-1mb.pdf

Exactly on nginx's limit

nginx's default of 1m means 1,048,576 bytes of request body. Your file is that size, but an upload also carries its form headers, so the request is a little bigger than the limit and a stock nginx answers 413 Request Entity Too Large. If the upload succeeds at this size, someone has raised client_max_body_size on that server or on the one in front of it.

Will a 1 MB PDF pass these upload limits?

LimitWritten asThis file
Express body-parser (default)the largest request body its JSON and form parsers accept. Express body-parser documentation100kbOver: rejected unless the limit is raised
nginx (default)the largest request body nginx passes on; a bigger one gets a 413 error. nginx core module documentationclient_max_body_size 1mRight at the limit: with the upload's own headers the request goes over it
PHP upload_max_filesize (default)the largest single uploaded file. PHP manual, core php.ini directives2MFits
PHP post_max_size (default)the largest whole POST request, all fields and files together. PHP manual, core php.ini directives8MFits
Gmail attachments (personal accounts)the largest total size of attachments on a message. Gmail Help, send attachments25 MBFits
Cloudflare upload limit (Free and Pro plans)the largest request body Cloudflare passes to your site. Cloudflare support docs, error 413100 MBFits

Each limit is the default or documented figure from the source named beside it. Your own server or plan may differ, and an upload is a request that carries headers as well as the file, which the "right at the limit" verdict allows for.

Still fine for PHP

PHP's default upload_max_filesize is 2M and its post_max_size is 8M, so this file passes both. A PHP site behind a default nginx therefore fails at the nginx step first, which is why a 413 from a PHP upload form is often not PHP's own message.

How long does a 1 MB upload take?

ConnectionTime to send 1,048,576 bytes
5 Mbps1.7 s
20 Mbps0.4 s
100 Mbps0.1 s

Best case: bytes times eight, divided by the speed in megabits per second, ignoring protocol overhead and the connection's ups and downs.

Use it for uploads, not for compression

The bytes that pad the file to its exact size are random on purpose, so they do not shrink. Running this file through the PDF compressor will barely change it, and zipping it saves almost nothing. For a compression test use a real document of your own, and keep this file for questions of the form: does my upload accept a file of this exact size?

Frequently asked questions

How do I download a 1 MB PDF file?
Press the download button on this page. Your browser builds a valid PDF of exactly 1,048,576 bytes in a moment and saves it as test-file-1mb.pdf. Nothing is uploaded and no file is hosted, so there is no link to copy: the file exists only on your device.
Is 1 MB 1,000,000 or 1,048,576 bytes?
This file is 1,048,576 bytes, the size Windows and nginx mean by 1 MB. Some services and macOS use 1,000,000. If a service documents its limit as 1 MB without saying which, test with this file and with a 1,000,000-byte file from the test file generator.
Why does nginx reject my 1 MB upload?
The default client_max_body_size is 1m, the same size as this file, and the upload's own headers push the request over it. Raise client_max_body_size in the http, server or location block, and check any proxy or load balancer in front of nginx for a limit of its own.
Can I get this file as a download link instead of generating it?
No, nothing here is hosted: the file is built on your device when you press the button, which is also how it can be exactly the size you ask for. For a script, generate the file once and keep it in your project. On Linux or macOS, head -c 1048576 /dev/zero > file.bin makes a file of this many bytes, though it is not a PDF.

Related tools