How to use the IF condition node on n8n
The IF node in n8n splits workflow data into True and False branches based on conditions like string contains or number greater than. Configure data types, operations, and expressions referencing previous nodes; test with Execute Node. Common issues include branch execution order and type mismatches—fix by matching data types and using Merge nodes.
Prerequisites
- n8n installed (self-hosted or cloud, version 1.0+)
- Basic workflow with input data (e.g., HTTP Request)
- Familiarity with expressions like {{ $json.field }}
- Understanding of data types (string, number, boolean)
Step-by-Step Instructions
Access n8n Dashboard and Create Workflow
Add the IF Node to Canvas
IF or If. Select the If node from Core Nodes and connect it to the previous node like a trigger or HTTP Request.Open IF Node Configuration Panel
Add a Single Condition
{{ $json.status }}. Set Value 2 (e.g., booked).Configure String Comparisons
{{ $json.name }} and John. Case-sensitive by default; use is for exact match. Test with Execute Node (play icon) to preview True/False outputs.Configure Number and Date Comparisons
{{ $json.age }} and 18; n8n auto-converts strings. For Date & Time, use is after with {{ $json.createdAt }} and ISO like 2026-03-01.Handle Boolean, Array, and Object Conditions
{{ $json.active }} and true. For Array, contains checks if {{ $json.tags }} includes urgent.Combine Multiple Conditions with AND/OR
{{ $json.age }} > 18 AND {{ $json.country }} contains US.Test and Debug the IF Node
Always Output Data for debugging if needed, but use sparingly as it forces True branch execution.Connect Branches with Merge Node
Common Issues & Troubleshooting
Branch not executing despite green output (e.g., TRUE halts after Wait node)
IF splits to both branches sequentially (True first); remove Wait nodes, manually execute stalled nodes, or use Merge after branches. Branches are independent.
Inverted boolean logic or falsy expression errors
Double-check expressions like <code>a.ok(nodeExists)</code>; ensure boolean evaluation matches intent (true/false).
Referencing unexecuted nodes or empty arrays
Execute previous nodes first; for arrays, use <strong>contains</strong> properly and handle empty cases with expressions.
Data type mismatches (e.g., string vs number)
Select correct data type in conditions; n8n converts where possible but match explicitly for reliability.
Case sensitivity issues in strings
Strings are case-sensitive by default; use lowercase expressions or <strong>is</strong> for exact non-case-sensitive if needed.