/n8n-tutorials

How to use IF node in n8n?

Learn how to use the IF node in n8n with clear steps, tips, and examples to build smarter, automated workflows.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to use IF node in n8n?

The IF node in n8n lets you split your workflow into two branches — true and false — based on conditions you define. You tell the IF node what to check (for example: “is the field status equal to active?”), and depending on the result, only the matching branch will execute. This is how you add real logic and decision‑making to your automation.

 

What the IF Node Actually Does

 

The IF node checks the incoming JSON data from the previous node. For each incoming item, it evaluates your condition. Items that match the condition go to the true output; all others go to the false output. Only the output that has data will continue running downstream nodes.

  • The IF node does not “loop”; it just evaluates conditions on incoming items.
  • If a condition depends on input — use expressions like {{$json.fieldName}}.
  • If the previous node returns multiple items, the IF decision is done for each item individually.

 

How to Use the IF Node (Practical Step-by-Step)

 

Here’s the simplest and most production‑useful way to set it up:

  • Add an IF node right after the node whose data you want to inspect.
  • In the IF node, choose Mode: Basic if you want an easy comparison (like equal, contains, greater than).
  • Pick the field to check. You can click the small gear icon → Add Expression and select the field from the incoming JSON, for example:
    {{$json.status}}
  • Select the operator, such as “equals”.
  • Enter the value to compare against, for example:
    active
  • Connect the true output to what should happen when the condition is met (for example, send an email).
  • Connect the false output to what should happen otherwise.

 

Example: Checking a Field from an API Response

 

Imagine the API node before the IF returns this JSON per item:

{
  "userId": 12,
  "status": "inactive",
  "name": "Jonas"
}

You want to run an action only for users with status = active.

In the IF node:

  • Field: {{$json.status}}
  • Operation: equals
  • Value: active

The result:

  • true branch: receives items whose status is active
  • false branch: receives all others, including the example above

 

Common Production Tips

 

  • Always check the actual JSON coming from the previous node. Use the “Data” view to see the real keys. A typo makes the IF always false.
  • If your field is nested (for example data.user.status), use:
    {{$json.data.user.status}}
  • If you need multiple conditions (for example AND / OR), you can add multiple rules inside the IF in Advanced mode.
  • If the condition feels too complex or dynamic, consider using a Function or Function Item node instead — those give you full JavaScript control.
  • If a branch should not run at all unless the condition is met, connect nodes only to the true or false output you need.

 

Simple Code Example Using a Function Node Before an IF

 

Sometimes you want to preprocess data and then check it. For example:

// This runs inside a Function Item node in n8n
// It adds a new boolean you might test in an IF

item.isAdult = item.age >= 18
return item

Then in the IF node, you simply test:

  • Field: {{$json.isAdult}}
  • Operation: equals
  • Value: true

 

Final Practical Summary

 

Use the IF node whenever you need branching logic. It reads incoming JSON, checks the condition you define, and sends items to either the true or false output. Use expressions like {{$json.field}} to reference real data. Keep conditions simple, and always verify your incoming fields using the node preview — that’s the most common source of mistakes.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022