Tips > Reliability & Performance

Configure Payload Size and Binary Data Mode for Large Files

By default, n8n stores binary data (files, images, PDFs) in memory and in the database.

By default n8n keeps binary data in memory and in the database, which causes out-of-memory crashes and database bloat once files pass 10-20 MB. Raise the request limit with N8N_PAYLOAD_SIZE_MAX and set N8N_DEFAULT_BINARY_DATA_MODE to filesystem so files are stored on disk and only references pass between nodes. This lets workflows handle large PDFs and archives reliably.

Why does n8n crash on large files by default?

By default, n8n stores binary data (files, images, PDFs) in memory and in the database. This causes out-of-memory crashes and database bloat when handling files larger than 10-20 MB. Two environment variables fix this immediately.

Real-world example: A workflow downloads vendor invoices as PDFs (5-50 MB each), processes them with an OCR service, and archives them to S3. Without these settings, the workflow crashes after the third file.

How do you configure payload size and binary data mode?

# .env or docker-compose.yml environment section

# Increase max payload from default 16MB to 256MB

N8N_PAYLOAD_SIZE_MAX=256

# Store binary data on filesystem instead of in database/memory

N8N_DEFAULT_BINARY_DATA_MODE=filesystem

# Set the directory for binary file storage (default: ~/.n8n/binaryData)

N8N_BINARY_DATA_STORAGE_PATH=/data/n8n-binary

# Also increase Node.js memory if processing very large files

NODE_OPTIONS=--max-old-space-size=4096
# docker-compose.yml example

services:
  n8n:
    image: n8nio/n8n:latest
    environment:
      - N8N_PAYLOAD_SIZE_MAX=256
      - N8N_DEFAULT_BINARY_DATA_MODE=filesystem
      - N8N_BINARY_DATA_STORAGE_PATH=/data/n8n-binary
      - NODE_OPTIONS=--max-old-space-size=4096
    volumes:
      - n8n_binary:/data/n8n-binary
    # ...

volumes:
  n8n_binary:

What changes after enabling filesystem mode?

After enabling filesystem mode, binary data is stored as files on disk and only references are passed between nodes. Memory usage drops dramatically.

Related: Flatten Deeply Nested API Responses · Use Docker Compose with Health Checks for n8n and PostgreSQL

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call