Large files in n8n: memory, binary data, and OOM crashes
By Clément Lacaille (Tech-Bharat) · Published 26 July 2026 · updated 5 November 2026 · 6 min read · how we build and test
Files and Binary Data — €29
PDF guide in English on this topic · 29 pages · November 2026 edition · 14-day guarantee
A workflow that downloads a two-page PDF or a small image runs fine no matter n8n's settings. The day that same workflow receives a 2GB video, a batch of high-resolution scans, or a CSV export with hundreds of thousands of rows, the instance can slow down and then crash with a memory error — often without a very explicit message. This guide explains how n8n actually handles binary data internally, which limits to configure, and how to design a workflow that absorbs large files without bringing the server to its knees.

How n8n stores binary data internally
Every time a node handles a file — an HTTP download, an email attachment, a Google Drive export, an upload through a form (the File field and multipart uploads have their own guide) — n8n wraps that content in a binary object attached to the item flowing between nodes. How that content is physically stored during execution depends on the mode set via the N8N_DEFAULT_BINARY_DATA_MODE environment variable:
filesystem— the default of a single instance since n8n 2.x: binary files are written to the instance's disk (under~/.n8n/storageon a new install, or the folder set byN8N_STORAGE_PATH), and only a reference travels between nodes. In our tests on n8n 2.46.4, receiving a 190 MiB upload added 29 MB of RAM.database— the default in queue mode: content is stored in n8n's own database, so every main and worker process sees the same files. It passes through memory on its way: +783 MB for the same 190 MiB upload. Each file is capped at 512 MiB by default (N8N_BINARY_DATA_DATABASE_MAX_FILE_SIZE, 1024 at most), and on SQLite the database file does not shrink when executions are deleted.default(memory) — binary content is kept in RAM for the entire execution. It is the costliest (+1,801 MB for the same upload, and 16 seconds instead of 2), and n8n prints a deprecation warning at start-up: this mode will be removed. If your instance still sets it explicitly, move tofilesystem.s3(andazure) — binary data is offloaded to a bucket. Restricted to Enterprise licenses, this mode is designed for queue mode and multi-worker setups.
Filesystem mode is not suited to queue mode without a shared network volume between workers (read-write EFS, for instance): since each worker has its own local disk, a file written by one wouldn't be visible to another, which is why n8n picks database mode there. That's one of the reasons our guide to queue mode and Redis recommends checking this point before scaling a pipeline that handles a lot of binary data.
Size limits worth knowing
Two environment variables cap the size of files a self-hosted instance accepts, with deliberately conservative defaults:
| Variable | Default | What it limits |
|---|---|---|
N8N_PAYLOAD_SIZE_MAX |
16MB | Maximum size of a JSON payload received (a standard webhook, an API response) |
N8N_FORMDATA_FILE_SIZE_MAX |
200MiB | Maximum total size of the files of one multipart/form-data request (upload via a Form Trigger or a file-type webhook); N8N_PAYLOAD_SIZE_MAX does not apply to these |
Both can be raised without a complex redeployment, simply by adding the variable to your docker-compose.yml or service configuration. n8n Cloud applies its own limits, generally more generous, without users having control over them. Raising these caps only solves part of the problem, though: beyond the size accepted on input, it's the RAM actually available on the server that determines whether the workflow holds up under load — see our guide to the real cost of self-hosted n8n to size a VPS accordingly.

Best practices for handling large files without crashing the instance
Filter before downloading. The most cost-effective habit: only fetch what the pipeline can actually process. A node that lists Google Drive files before downloading them should filter by MIME type and size at that very step, as recommended in our Google Drive automation guide — better to skip a 2GB video than to load it into memory just to reject it afterward.
Check that you really are in filesystem mode. It is the default of a single n8n 2.x instance, but older docker-compose.yml files often still set N8N_DEFAULT_BINARY_DATA_MODE=default. This is the setting to check first, before even bumping the server's RAM.
Keep large files out of Code nodes. Reading a file with getBinaryDataBuffer() copies it into the main process and into the task runner: on a 190 MiB file we measured about +1 GB in each, even in filesystem mode. Name, type and size in bytes are readable in expressions ($binary.data.bytes) without loading anything.
Avoid carrying the full binary payload through the entire workflow. When only a piece of metadata is needed downstream (name, size, hash), extract it early and leave the binary behind rather than dragging it from node to node all the way to the end. A Code node placed right after the download can keep only what's actually needed for the rest of the flow.
Process in batches rather than as a single block. For processing a list of files (scans to OCR, invoices to extract), the Loop Over Items pattern avoids holding every file in memory at once — the load stays bounded to the batch size, regardless of the total volume to process. The same principle protects against 429 errors when calling an AI API on each file, as detailed in our rate limits guide.
Stream to the final destination rather than loading everything then sending it all back out. For a download-to-cloud-storage pipeline, it's better for the destination node to consume the binary stream directly rather than adding an unnecessary intermediate accumulation step. This matters especially for meeting transcription workflows, where source audio or video files can easily exceed several hundred MB.
Filesystem, S3, or database: which to choose
| Situation | Recommendation |
|---|---|
| Single instance, any file size | Filesystem mode (the default since n8n 2.x) |
| Queue mode with multiple workers, Enterprise license available | S3 mode |
| Queue mode, no Enterprise license | Database mode (the default there), on PostgreSQL, files well under the per-file cap; or a shared network volume in filesystem mode |
An instance still set to default |
Move to filesystem mode |
In a pipeline close to the one in the RAG Assistant Pack ($119), which ingests PDFs into a Supabase vector store, filesystem mode keeps a batch of scanned contracts, each several dozen MB, from saturating the instance's memory during text extraction and chunking. The same reasoning applies to an audit pipeline archiving large supporting documents, as in the Compliance & Audit Pack ($149): the audit trail itself needs to stay lightweight, while source documents are processed in batches and never all sit in memory at once.
Each of these modes, measured on n8n 2.46.4 with 50 and 190 MiB files (uploads, downloads, a Code node, the S3 node, four uploads at once), is in our PDF guide Files and Binary Data, with where files sit on disk and when they are deleted, the upload limits and the error each one returns, and archives, images and S3 storage.
A question older than n8n
The choice between storing a large object in a database or on a filesystem isn't specific to n8n — it's a classic systems design question. A landmark Microsoft Research study, To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem? (Sears, van Ingen & Gray, 2006), measured this trade-off at scale and found that below roughly 256KB, storing the object in the database remains faster, while above roughly 1MB, the filesystem wins clearly — with the gap widening further as size increases. The exact threshold depends on the hardware and has shifted a lot since 2006, but the underlying principle still holds: n8n's filesystem and s3 modes exist precisely because past a certain size, having the instance's database (or its RAM) carry the binary payload becomes the wrong architectural choice, not just a configuration detail.
Going further
A workflow that handles large files deserves the same discipline as any critical pipeline: an Error Workflow that cleanly catches a failed download, a retry-with-backoff policy instead of failing outright, and memory monitoring on the instance as described in our n8n monitoring guide. Combined with a binary storage mode matched to the actual volume handled, these settings turn a classic point of fragility into an automation pipeline that holds up over time.
FAQ
Frequently asked questions
Why does my n8n workflow crash with a memory error on a large file?
Since n8n 2.x a single instance stores binary data on disk by default (filesystem mode), so the usual culprits are elsewhere: an instance still set to the in-memory default mode, database mode (the default in queue mode), or a Code node that loads the whole file. Measured on n8n 2.46.4 with a 190 MiB upload: +29 MB of RAM in filesystem mode, +783 MB in database mode, +1,801 MB in the in-memory mode, and about +1 GB in the main process plus +1.2 GB in the task runner as soon as a Code node read the file.
What's the maximum file size you can send to an n8n webhook?
By default, a self-hosted instance caps JSON payloads at 16MB via N8N_PAYLOAD_SIZE_MAX, and files sent as form-data (file uploads) at 200MiB via N8N_FORMDATA_FILE_SIZE_MAX. Both are configurable via environment variables, within the limits of the RAM and disk actually available on the server.
Is S3 mode for binary data available on the free Community Edition?
No. External S3 storage for binary data requires an n8n Enterprise license. On self-hosted Community Edition, the options actually available are filesystem mode (the default of a single instance), database mode (the default in queue mode), and the in-memory default mode, which n8n has deprecated and announces it will remove.
Does filesystem mode work in queue mode with multiple workers?
Not reliably without shared storage, since each worker has its own disk. That is why n8n 2.x uses database mode by default in queue mode: every process reads the files from the shared database, within a per-file cap of 512 MiB by default (N8N_BINARY_DATA_DATABASE_MAX_FILE_SIZE, 1024 at most). With an Enterprise license, S3 mode is the alternative for large files.