How to download an S3 folder as a zip file
S3 has no folder-download endpoint and no server-side zip — a folder is just a shared key prefix, and every object under it has to be fetched individually. The AWS CLI's aws s3 sync pulls the whole tree to disk; S3 Viewer's Download as zip instead streams each object straight into a zip archive and sends the finished file to your browser, without ever holding the whole thing in memory. It's capped by object count and total size so a request can't quietly try to zip an entire bucket.
Step-by-step.
- 01
In S3 Viewer: Download as zip
Choose Download as zip from a folder row's ⋮ menu, or select several files and folders and use it from the selection toolbar. S3 Viewer lists everything under the prefix(es), checks the total count and size are within limits, and then starts the download — the browser shows the usual save-file prompt once the archive is ready. - 02
AWS CLI: sync the folder to disk, then zip it locally
aws s3 syncmirrors the prefix to a local directory; zip it yourself once it's down. This downloads every object individually to your machine before anything is archived.aws s3 sync s3://my-bucket/reports/2026/ ./2026 cd .. && zip -r 2026.zip 2026 - 03
SDK: list, get each object, stream into an archive
Any zip library that accepts a stream can be fed oneGetObjectbody at a time as you page throughListObjectsV2— this is the same shape S3 Viewer's server-side archive route runs, minus the size and count checks.const archive = archiver('zip', { zlib: { level: 0 } }); archive.pipe(outputStream); for await (const key of listAllKeys(bucket, prefix)) { const { Body } = await s3.getObject({ Bucket: bucket, Key: key }); archive.append(Body, { name: key.slice(prefix.length) }); } await archive.finalize(); - 04
Why S3 Viewer stores rather than compresses
The archive is built with zip's store method (no compression), since most object storage already holds compressed formats (images, video, PDFs) where re-compressing wastes CPU for negligible size savings. The trade-off is a larger zip than a deflate-compressed one would produce for genuinely compressible content, in exchange for a much faster archive. - 05
Limits exist so a zip can't quietly become a whole bucket
A folder with more objects thanMAX_ARCHIVE_OBJECTS(10,000 by default) or more total bytes thanMAX_ARCHIVE_BYTES(10 GiB by default) is refused up front, before any object is read, with a message naming which limit was hit. An operator self-hosting S3 Viewer can raise both via environment variables.
What's actually happening.
A prefix isn't a container S3 can hand you as one unit — it's a filter over a flat list of keys. Turning it into a single downloadable file means listing every key under it, reading each object's body, and writing all of them into an archive format, which is exactly what S3 Viewer's/v3/archive route does: ListObjectsV2 to expand any folder keys recursively, then one GetObject per file streamed straight into a zip being written to the response — nothing is buffered on disk or held fully in memory.
Because building the archive can take a while and touches many objects, the route checks the total object count and byte size against configured limits before it starts streaming anything, and returns a short-lived, single-use download token rather than the file itself — the actual archive is fetched with a second request against that token, which is what lets the browser show a normal save dialog instead of the page navigating away mid-download.
The archive uses zip's store method — no deflate compression — partly for speed and partly because most object storage already holds pre-compressed formats. zip64 is enabled so the format itself has no 4 GiB or 65,535-file ceiling; the configured MAX_ARCHIVE_BYTES and MAX_ARCHIVE_OBJECTS are what actually bound a request, and both exist to keep one download from turning into an unbounded read of an entire bucket.
Common questions.
Can I download an entire S3 folder as one zip file?
Does S3 have a native zip download feature?
How do I download a folder from S3 using the AWS CLI?
Is there a size limit on zip downloads in S3 Viewer?
What happens if an object fails to download partway through the zip?
Does the zip download work the same way on R2, B2 and MinIO?
Skip the CLI. Try it in the browser.
S3 Viewer turns the steps above into a single click. Open source, self-hostable, free.
Why teams pick this
More how-tos
Upload large files
How large uploads work in S3 Viewer and from the CLI — streaming, retries, and the 5 GB single-PUT cap.
Download a file
Browser, AWS CLI, or presigned URL — three ways, with the object's own filename and zero key exposure.
Bulk-delete files
DeleteObjects API explained — up to 1,000 keys per request, and how versioning changes the answer.