Real processes treat cases differently: urgent vs normal, paid vs free, found vs not found.
Branching means sending different items down different paths. n8n has two main nodes for it.
The If node checks conditions and has two outputs: true and false. Each condition compares a value (often an expression like {{ $json.amount }}) with something, using a type-aware operator: for strings (text), numbers, dates, booleans (true/false), arrays (lists) and "exists / is empty". Combine several conditions with AND or OR.
Because n8n works item by item, one If node can split a batch: of 20 orders, 5 go out of "true" and 15 out of "false", and each branch continues with only its own items.
The Switch node is for more than two routes. In Rules mode you add a rule per output (output 0: country is "US"; output 1: country is "DE"...). Turn on a fallback output to catch items no rule matched, so nothing silently disappears. In Expression mode, an expression returns the output number directly.
Tips:
- Choose the right data type. Comparing numbers as text gives wrong results (as text, "100" comes before "20").
- Check both outputs while testing; an empty branch simply doesn't run.
- The Filter node is the simpler choice when you just want to drop items rather than route them.
After branching you often want to bring the data back together, which is the Merge node's job.
Remember
- If routes each item to true or false
- Switch handles many routes; add a fallback output
- Use the correct data type in conditions