Master N8N's approach to handling large datasets — split thousands of items into manageable chunks, understand automatic iteration, and respect API rate limits like a pro.
When you need to process a large list of items — think 1,000 contacts, 500 orders, or 10,000 spreadsheet rows — sending them all at once is dangerous. The SplitInBatches node divides your data into fixed-size chunks and loops through each batch automatically, giving you fine control over throughput.
✂️
Split
Divides large arrays into fixed-size chunks you define
Core Node
🔄
Loop
Automatically loops back until all batches are processed
Built-in
⚙️
Configure
Set batch size: 10, 50, 100 — your exact choice
Flexible
📊
Track
Access current batch index and total count in expressions
Context Vars
SplitInBatches Loop Flow — Processing 1,000 Contacts in Batches of 50
Input 1,000 items
→
SplitInBatches Batch size: 50
→
Process Batch items 1–50
↑ loop back if more batches remain ↓ continue to Done if finished
Batch #2 items 51–100
→
...20 total batches
→
Done ✓ All processed
🔄 SplitInBatches sends back to itself until no items remain in the queue
💡
How to Add SplitInBatches
Click the + button in your workflow, search for "SplitInBatches", and set the Batch Size field. Connect the loop output back to your processing node, and the done output to your final step. The node handles all the counting for you.
2How N8N Naturally Iterates
Here is something powerful about N8N that beginners often miss: every node automatically processes all items in sequence. If a previous node outputs 10 items, the next node runs 10 times — once per item. No loop node required for basic use cases.
Natural Iteration — Zero Loop Nodes Needed
HTTP Request returns 5 users
→
Set Node runs 5× automatically
→
Send Email 5 emails sent
→
Done 5 results
This means for most workflows, you do not need any loop node at all. N8N's execution engine handles iteration automatically. You only need SplitInBatches when you want to control the chunk size for rate limiting, add delays between batches, or manage server memory on very large datasets.
Auto
Default iteration behavior
0
Extra nodes for basic loops
∞
Items N8N can process per run
3Rate Limiting — Why Batching Matters
⚠️
API Rate Limits Are Real — And Costly
Most APIs cap requests per minute or per second. Sending 1,000 requests instantly will get your API key blocked or throttled. Mailchimp allows 10 req/sec. Clearbit allows 20 req/min. Stripe allows 100 req/sec. Always check the API docs and use SplitInBatches + a Wait node to stay safely within limits.
Beyond rate limits, batching also protects your N8N server's memory. Processing 50,000 spreadsheet rows all at once can crash a low-memory instance. Batching keeps memory usage flat and predictable across long-running workflows.
Scenario
Batch Size
Delay Between Batches
Reason
Email sending (Mailchimp)
50 / batch
1,000 ms
10 req/sec limit
CRM contacts (HubSpot)
100 / batch
500 ms
100 req / 10 sec limit
Database inserts (Postgres)
200 / batch
0 ms
Memory management only
AI API calls (OpenAI)
5 / batch
2,000 ms
Strict RPM limits on free tier
🔵
Add a Wait Node Between Batches
Place a Wait node between the SplitInBatches loop output and your processing node. Set it to 1 second. This creates a natural pause between each batch and keeps you comfortably within most API rate limits without any extra code.
4N8N Loop Expressions in Code
When using the Code node inside a SplitInBatches loop, you can access batch context information using N8N's built-in node variables. Here is how to work with batch data programmatically and add metadata to processed items:
JavaScript — Code Node
// Get current batch info from SplitInBatches contextconst batchIndex = $node["SplitInBatches"].context.currentRunIndex;
const totalItems = items.length;
// Log progress for debugging in execution logconsole.log(`Processing batch #${batchIndex + 1} with ${totalItems} items`);
// Process each item — spread keeps all original fieldsreturn items.map(item => ({
json: {
...item.json, // keep all original fields
processed: true, // add processed flag
batchNumber: batchIndex, // track which batch
processedAt: newDate().toISOString()
}
}));
🔧
The Spread Operator Pattern
The ...item.json spread copies all existing fields from the item and lets you add new ones on top without losing any data. This is the most important pattern in N8N Code nodes — always spread first, then add your new fields.
5Loop Approaches Compared
N8N gives you three distinct ways to loop over data. Choosing the right approach depends on your data volume, API rate limits, and whether you need in-memory transformations or external API calls.
⚡
Natural Iteration
N8N automatically runs each node for every output item. Zero configuration. Perfect for small datasets and simple flows.
Default behavior
📦
SplitInBatches
Chunk large datasets and loop with configurable delays. Best for rate-limited APIs and processing 1,000+ items safely.
Best for scale
💻
Code Node Loop
Write a JS for/while loop inside a Code node. Use only for in-memory data transformations — never for external API calls.
Advanced / edge cases
Method
Best For
Rate Limit Safe
Memory Usage
Natural Iteration
Under 100 items, simple flows
Risky at scale
Low
SplitInBatches
1,000+ items, API calls
Yes with Wait node
Controlled
Code Node Loop
Data transformations only
In-memory only
Medium
6Batch Processing by the Numbers
50
Items per batch (recommended default)
1s
Recommended delay between batches
20×
Batches for 1,000 items at size 50
💪
Pro Tip: Start Conservative
Start with a batch size of 10–20 when testing a new API integration. Once you confirm it works reliably, increase to 50–100. It is much easier to scale up than to debug a blocked API key from an overly aggressive first run.
🧠 Knowledge Check — Lesson 9
Q1 — Which N8N node processes items in fixed-size chunks and loops automatically?
LoopNode
SplitInBatches
BatchProcessor
ChunkItems
Q2 — Why use batching instead of processing all items at once?
N8N cannot process more than 10 items at once natively
To avoid API rate limits and prevent memory overload
Batching is always faster than direct processing
Required for all workflows with more than 10 items
Q3 — What does N8N do with multiple output items by default (natural iteration)?
Processes only the first item and discards the rest
Requires a dedicated loop node to handle multiple items
Automatically iterates — runs each downstream node once per item