Introduction
Every real-world workflow eventually hits a fork in the road: send a notification only if a deal is above $10,000, process an order differently based on its status, skip a step when a field is empty. n8n handles all of this through conditional branching — routing execution down different paths based on the actual data flowing through your workflow.
n8n gives you two nodes for this: IF for binary yes/no decisions, and Switch when you need more than two outcomes. Knowing which one to reach for, and how to configure conditions precisely, is what separates brittle workflows from ones that hold up in production.
The IF Node: Binary Branching
The IF node evaluates one or more conditions against your input data and routes each item to either the TRUE output or the FALSE output. Nothing goes to both — every item picks exactly one path.
To configure it, you pick a value from your incoming data (usually a field reference like the expression syntax), choose an operator, and set a comparison value. n8n supports a range of operators per data type:
For strings: equals, not equals, contains, starts with, ends with, regex match. For numbers: equals, not equals, greater than, less than, greater than or equal, less than or equal. For booleans: is true, is false. For arrays and objects: is empty, is not empty.
Here is a simple example: a webhook receives order data and you want to route high-value orders to a special Slack channel.
In the IF node you would set: Value 1 — expression referencing the order amount field Operation — Greater Than Value 2 — 10000
Items where the amount exceeds 10,000 exit from the TRUE output. Everything else exits from FALSE. You then connect each output to its own downstream nodes.
You can stack multiple conditions inside one IF node using AND (all must pass) or OR (any one passing is enough). Keep in mind that AND chains can get hard to read past three conditions — at that point, splitting into sequential IF nodes or switching to Switch is usually cleaner.
The Switch Node: Multiple Outcomes
When you have more than two possible routes, stacking IF nodes gets messy fast. Switch lets you define multiple rules, each with its own output, evaluated top to bottom. The first rule that matches wins, and the item exits from that output.
Switch also has a Fallback output — items that match no rule land here. Always connect something to the fallback, even if it is just a No Operation node, so you know what happened to unmatched items.
A practical example: you receive support tickets and want to route them by priority.
In n8n you configure each rule the same way you configure an IF condition — pick a field, choose an operator, set a comparison value. The difference is that each rule gets its own numbered output connector on the node.
One subtlety worth knowing: by default, Switch routes each item to only the first matching rule. If you enable the "Send data to all matching outputs" toggle, an item can exit from multiple outputs simultaneously. This is useful but can cause duplicate downstream actions if you are not expecting it — leave it off unless you explicitly need fan-out behavior.
Common Mistakes
Type mismatches cause silent failures more than anything else. If your incoming field contains the string "1500" and you compare it with Greater Than 1000 using a Number operator, n8n may not coerce the string automatically depending on where the data came from. Use the Set node or an expression like parseInt() to normalize types before branching.
Another common mistake is leaving the FALSE output of an IF node or the Fallback output of a Switch node unconnected. n8n will not throw an error — those items simply disappear from the execution. In a workflow that processes customer records, silent drops like this can be hard to debug later. Wire every output to something, even a minimal logging step.
Also watch out for empty or null fields. Comparing a null value with "equals some string" will evaluate to false, which is usually what you want — but "is empty" and "is not empty" behave differently from "equals empty string". Test with actual null payloads, not just empty strings.
Summary
Use the IF node when your decision is binary — TRUE or FALSE, yes or no, match or no match. Use Switch when you have three or more distinct outcomes and want clean, separate output paths without chaining multiple IF nodes. In both cases, always handle the non-matching path explicitly, normalize data types before comparing, and test with edge-case inputs (nulls, empty strings, unexpected types) before deploying to production. These two nodes are the foundation of any workflow that does real conditional logic.
Lesson Checkpoint