Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Branching · n8n

Direct answer

Branching in n8n uses the IF and Switch nodes to send items down different paths based on conditions, merging them later with the Merge node if needed.

When to use this

Use this when n8n workflows branch with IF and Switch nodes.

First 30 seconds

1. Branching with IF and Switch nodes.

2. Always handle the else/fallback path.

3. Merge branches carefully (wait modes).

4. Test each path.

5. Keep logic readable.

Operational verification

items → IF/Switch → branches → merge

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
n8n workflow branching
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformn8n workflow branching · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when n8n workflows branch with IF and Switch nodes.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The primary procedure is: Execute the workflow with pinned fixture data; inspect the Branch/If node input and each output branch in the execution view; verify only the intended downstream target changed. Exercise failure-oriented cases such as null/missing fields, string-versus-number coercion, empty item sets, multiple matching rules and expression errors so the test covers failure cases, not only the happy path.

Step 2 Common mistakes Narrow the fault
  • IF branches without a default path.
Step 3 Where it fails Narrow the fault

Failure analysis for n8n → Branching should follow the path through the components: trigger/input acquisition → expression evaluation → branch selection → downstream node execution → external target state. Tests should include edge cases such as null/missing fields, string-versus-number coercion, empty item sets, multiple matching rules and expression errors.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • IF and Switch nodes branch workflows.
  • Merge rejoins branches.
  • Test each path.
Key checks
  • IF/Switch nodes — branching
  • Default/fallback branch — unexpected values
  • Merge node behaviour — joining
ReferenceWhy it matters1 section · depth on demand

In depth

Branching in n8n routes items down different paths with the IF node (true/false) or the Switch node (multiple outputs by rule). Items are evaluated individually, so one input list can be split across branches.

NodeUse
IFTwo-way split on a condition
SwitchMany outputs by value or rule
MergeJoin branches back together
FilterDrop items that do not match

Be careful when merging: the Merge node's mode (append, combine by key, wait for both) decides whether data from both branches lines up as intended.

ReferenceImportant terms & boundaries1 section · depth on demand

Mechanics

Branching in n8n is owned at runtime by the n8n execution engine evaluating an If/Switch decision for one workflow execution. The durable intent is workflow JSON containing node parameters, expressions and outgoing connections. Reliable automation must carry stable identity across the path: workflow ID/version, execution ID, node ID and credential bindings. The consumer-visible target is the downstream branch nodes and any external systems they mutate. The key invariants are exact input item set, expression data types, comparison operators, branch ordering and item routing semantics.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Lifecycle

Store and review workflow JSON containing node parameters, expressions and outgoing connections; pin or at least record implementation/model versions and keep environment-specific identity outside reusable logic where possible. The stable identity contract is workflow ID/version, execution ID, node ID and credential bindings.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docn8n workflow branching current

Authoritative/upstream documentation reviewed for bounded claims in n8n > Branching. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.if/ · confidence 94%
Embedded reference data

Quick lookup tables

n8n → Branching · operational reference

Context-specific ownership, verification, output and failure-boundary lookup for n8n → Branching.

Layern8n → Branching operational reference
Runtime/ownershipn8n workflow branching · the n8n execution engine evaluating an If/Switch decision for one workflow execution
Persistent intentworkflow JSON containing node parameters, expressions and outgoing connections
VerificationExecute the workflow with pinned fixture data; inspect the Branch/If node input and each output branch in the execution view; verify only the intended downstream target changed.
Expected interpretationEach fixture item follows the branch implied by the evaluated n8n expression, nonmatching items do not reach protected side effects, and downstream target state matches the selected path.
Recovery boundarypreserve execution data and node input/output, correct the first wrong expression or route, then replay a bounded fixture and verify the downstream target
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

At minimum retain workflow ID, execution ID, node ID, input item index, evaluated fields, rule/operator, chosen output index, downstream node IDs, run status and external object IDs. The useful output makes ambiguity visible, links to the target identity from workflow ID/version, execution ID, node ID and credential bindings, and provides enough context to safely decide whether a retry is permitted.

Confirmation

Confirm action

Continue?