IF & Switch in n8n

From the n8n cheat sheet · Essential Nodes · verified Jul 2026

IF & Switch

Conditional branching in workflows

yaml
# IF Node (Two-way branching)
Condition: {{ $json.status }} equals "active"
- True branch → Process active items
- False branch → Handle inactive

# Switch Node (Multi-way routing)
Mode: Rules
Rule 1: {{ $json.type }} equals "order" → Order path
Rule 2: {{ $json.type }} equals "refund" → Refund path
Fallback → Default path
💡 Use Switch node instead of nested IF nodes
⚡ IF node is data type aware (string, number, boolean)
📌 Switch has fallback route for unmatched cases
🎯 Name your output paths descriptively for clarity

More n8n tasks

Back to the full n8n cheat sheet