Conditions: IF, Switch and Filter
Three nodes turn a linear workflow into a branching one, and the difference between them is not what they do but what they return:
- IF — two outputs: matching items leave through
true, the rest throughfalse. Nothing is lost. - Switch — several outputs, each with its own rule. For multi-way routing.
- Filter — one output: non-matching items are simply dropped. There is no path for them.
The selection rule is simple: use IF when you need to do something with the non-matching items, Filter when you just need to discard them, and Switch when there are more than a couple of routes.
| Node | Outputs | Non-matching items | When |
|---|---|---|---|
| IF | 2 (true / false) | Continue down the false branch | Both cases need a reaction |
| Switch | One per rule (+ a fallback) | Go to the fallback output | Routing by category |
| Filter | 1 | Dropped — no trace | Cleaning junk data out |
Conditions work per item. If 50 items reach the node, IF evaluates each one separately: 30 may leave through true and 20 through false. This is not "does the whole dataset match" logic.
Type mismatch is the most frequent mistake. "5" from an API is a string, while 5 is a number. When a condition does not behave as expected, look at the value's type in the node output first: quotes mean it is a string. You may need to convert before comparing.
Mind empty values. undefined, null and an empty string are not the same thing. "The field exists" and "the field is not empty" are different conditions, and real API data contains both.
In a branching workflow every path needs an ending. Leaving an IF node's false output empty is usually a mistake: items vanish silently and nobody notices. At minimum add a No Operation node or log them, so you can answer "where did the data go?" later.
📚 Sources and documentation
- Split with conditionalsofficialdocs.n8n.io
- IF nodeofficialdocs.n8n.io
- Switch nodeofficialdocs.n8n.io
- Filter nodeofficialdocs.n8n.io