Overview
This lesson is part of the n8n AI Automation - Zero to Hero course, Section: 3. Deep Dive Concepts.
Watch the video above for the full tutorial, or read the written guide below.
What does the Remove Duplicates node do in n8n?
The Remove Duplicates node filters out repeated items in your workflow data, offering three operations: remove items repeated within the current input, remove items processed in a previous execution, or clear the duplication history entirely. Without it, downstream nodes receive repeated records, which can trigger multiple emails to the same customer, duplicate orders in your database, or skewed dashboard reports. It is a core data-integrity node in any business automation pipeline.
How to configure the Remove Duplicates node to deduplicate by a specific field
The Remove Duplicates node's most critical setting is the Comparison field, which controls what counts as a duplicate. Three options are available: All Fields (every field must match for a row to be flagged), All Fields Except (useful when you want to exclude one field and compare everything else), and Selected Fields (compare only the fields you explicitly choose). In the lesson workflow, 41 order records contained repeated order IDs across three entries for the same order. Selecting Selected Fields and dragging in the order_id field reduced the 41 records to 13 unique orders.
Once deduplication is set, open the Options panel, click Add Field, and enable Remove Other Fields. This strips every field except the ones used in comparison, so only the 13 unique order IDs pass forward. That keeps the payload lean before it hits the Aggregate node, which then bundles all IDs into one item for a single email or Slack message.
The correct workflow architecture is one Remove Duplicates node per branch, not a shared node after merging branches. In the lesson, merging all four switch branches (pending, processing, cancelled, refunded) into one Remove Duplicates node caused the downstream Aggregate and email nodes to execute four times, sending four separate messages. The fix was to place individual Remove Duplicates nodes on the pending and processing branches, and to use a Merge node before a single Remove Duplicates node on the combined cancelled-and-refunded branch, since both shared the same final actions.
Key Takeaways
- The Remove Duplicates node offers three operations: deduplicate within the current input, deduplicate against previous executions, or clear duplication history.
- The Comparison setting determines what a duplicate is. Selected Fields is the right choice when you only need to compare one or two fields (such as
order_id) rather than entire rows. - Enabling Remove Other Fields in Options discards non-compared fields immediately, keeping the data payload minimal before it reaches downstream nodes.
- Each branch in a Switch node should have its own Remove Duplicates node. Merging branches before deduplication causes every downstream node to execute once per branch, generating multiple emails or messages.
- Skipping deduplication in a real workflow produces visible business errors: the lesson email showed the same order IDs repeated multiple times before the node was added, then collapsed to 13 unique IDs after.
Related Lessons
- Lesson 11: How Branching works in n8n Workflows | Smart Automations with Multiple Paths
- Lesson 12: How to Use Merge Node in n8n | Combine Data Like a Pro
- Lesson 13: How to Use Set Node in n8n | Edit Fields Node | Add, Edit, Clean Data
- Lesson 14: How to Use Aggregate Node in n8n | Combine & Summarize Data
- Lesson 16: How to connect Google Forms & Webhook Node in n8n | Google Forms Integration
Next Steps
Continue your n8n journey with the full n8n AI Automation - Zero to Hero course.