# IF and Switch in n8n: Route Work by Rules

> Learn the n8n If and Switch nodes: build a condition, see the true and false branches, add routing rules with named outputs and a fallback, then publish.

Source: https://learn.ynteractive.com/content/n8n-if-and-switch-node-tutorial · Updated 2026-10-13 · Free from Stepthrough (https://learn.ynteractive.com)

## Practice it step by step

[Start the free practice](https://learn.ynteractive.com/modules/n8n-if-switch)

You do every step yourself in a practice copy of n8n. It checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, about 10 minutes, and nothing touches your real accounts. [Open full screen](https://learn.ynteractive.com/modules/n8n-if-switch)

Free · Live now · [n8n Automation Toolkit](https://learn.ynteractive.com/content/course/n8n-automation-toolkit) · [n8n](https://learn.ynteractive.com/content/tool/n8n) · Gmail · Google Sheets · ~10 min · 40 steps · Intermediate

Updated October 13, 2026. Built against the tool’s current screens and checked step by step. [How we check this lesson](https://learn.ynteractive.com/content/about#how-we-check)

Real work needs rules: big jobs go to the owner, small ones go in a log, emergencies skip the line. In [n8n](https://learn.ynteractive.com/content/tool/n8n), two nodes handle that. The [If node](https://learn.ynteractive.com/content/glossary/if-node) asks one yes or no question and sends each item down a true or [false branch](https://learn.ynteractive.com/content/glossary/true-and-false-branches). The [Switch node](https://learn.ynteractive.com/content/glossary/switch-node) gives you as many outputs as you need, one per rule, plus a fallback for anything that matches none of them. In this free n8n IF and Switch node tutorial you build both on a real-looking workflow, check the data on every branch and publish.

## At a glance

| Question | Answer |
| --- | --- |
| What you build | Send each request where it belongs. Use an If node to split big jobs from small ones, then a Switch with named outputs and a fallback to route by service. |
| Tools | n8n |
| Time | About 10 minutes, 40 steps in 5 parts |
| Level | Intermediate |
| Cost | Free |
| Ways to learn it | [Practice it step by step](https://learn.ynteractive.com/modules/n8n-if-switch) |

### The 5 parts, in short

1. Send a test request: Run the workflow, Fill in the test form, Pick a service, Enter a budget, and 2 more steps.
2. Add an If: Add the next step, Search for If, Pick If, Drag in the budget, and 6 more steps.
3. Connect true and false: Connect true, Connect false.
4. Add a Switch: Add a step before If, Search for Switch, Pick Switch, First rule: the service, and 14 more steps.
5. Wire it up and publish: Connect Emergency, Connect Fallback, Publish, Publish it.

**Start here first:** [Find and Use n8n Templates](https://learn.ynteractive.com/content/find-and-use-n8n-templates) (module 1 of n8n Automation Toolkit)

**In the course:** [Part 9 · n8n Automation Toolkit](https://learn.ynteractive.com/content/course/part-9-n8n-automation-toolkit) (Module 48 of the [full course](https://learn.ynteractive.com/content/course))

**Part of:** [n8n Jump Start](https://learn.ynteractive.com/content/paths/n8n-jump-start) (step 3 of 7). Next up: [n8n: Talk to Your Google Sheets with ChatGPT, from Zero (Free Credits or API Key, Google, Sheet, Chat)](https://learn.ynteractive.com/content/n8n-talk-to-google-sheets-chatgpt-ai-agent)

## What you will build

You will finish a workflow for Harbor Point Handyman, a small handyman business that takes service requests through an n8n form. The form asks for a name, a service (Repair, Installation or Emergency) and a budget. Two actions are already set up in the workflow: a [Gmail](https://learn.ynteractive.com/content/tool/gmail) step called Send a message that emails the owner, and a Google Sheets step called Append row in sheet that adds the request to a log. What is missing is the part that decides which action each request should reach.

First you add an If node that checks whether the budget is greater than 1,000. Requests over that go down the true branch to the owner, and everything else goes down the false branch to the log. Then the owner asks for more, so you put a Switch in front of the If. Repairs keep the budget check, emergencies go straight to the owner whatever the budget, and anything else, such as installations, lands in a Fallback output that feeds the log.

## Who this n8n If node tutorial is for

This module is for small business owners, office managers and anyone who has built a simple n8n workflow and now wants it to make decisions. You do not need to code, write expressions by hand or have an n8n account to practice. The form and the two actions are ready when you start.

## If vs Switch in n8n: when to use which

Use the If node when the question has two answers. It has exactly two outputs, true and false, and every item takes one or the other, never both. You can add more conditions with Add condition and combine them with AND or OR.

Use the Switch node when you need three or more routes. In Rules mode each routing rule gets its own output, numbered 0, 1, 2 until you switch on Rename Output and give it a name. The Switch checks the rules in order and sends an item to the first one that matches, unless you turn on the Send data to all matching outputs option. Without a fallback, items that match no rule are simply dropped. Setting Fallback Output to Extra Output gives them their own output, called Fallback, so nothing disappears without you noticing.

## Numbers, text and Convert types where required

Every condition compares value1 with value2 using a comparison from one of six groups: String, Number, Date & Time, Boolean, Array and Object. Pick the group that matches your data. A budget is a number, so it uses Number, is greater than. A service name is text, so it uses String, is equal to.

An n8n form sends a Number field as a real number, so the rule works as it is. Data from other places, such as a [webhook](https://learn.ynteractive.com/content/lovable-n8n-web-app-ai-backend), sometimes sends numbers as text. If a condition complains about the type, switch on Convert types where required and n8n will convert the value before it compares.

## How to use this in your business

Send high-value leads to a salesperson and the rest to a newsletter list. Flag invoices over a set amount for approval. Route support messages by topic to the right person, with a fallback inbox for anything unexpected. Start with an If, reach for a Switch when the routes grow, and always add a fallback.

## How the interactive lesson works

Every step is shown first on the left, in the Watch panel, with a short voice-over. Then you do it yourself on the right, in Your turn, on a practice copy of n8n and its test form. If you get stuck, press Do it for me and the step is done for you. No email is sent and nothing goes online, so you can make mistakes freely, then build it for real.

## Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of n8n, checks each step, and never touches your real accounts.

[Start “IF and Switch in n8n: Route Work by Rules”](https://learn.ynteractive.com/modules/n8n-if-switch)

## Step by step: IF and Switch in n8n: Route Work by Rules

All 40 steps of the interactive module, in order. In the module you watch each one, then do it yourself in a practice copy that checks your work.

### 1. Send a test request

1. **Run the workflow.** This workflow has a form trigger and two actions that aren't connected yet. To get some real data to route, click **Execute workflow**.
   Harbor Point Handyman's service form is ready, and so are two actions: an email to the owner, and a new row in the request log. Nothing decides which one runs yet. First, get a real request to work with.
2. **Fill in the test form.** n8n opened the test form. Fill it in like a customer: type a name, for example **Nora Castillo**.
   The test version of the form just opened. Fill it in like a customer would.
3. **Pick a service.** Under **Service**, choose **Installation**.
   For the service, choose Installation.
4. **Enter a budget.** In **Budget**, type **2500**.
   And a budget of 2,500 dollars.
5. **Submit.** Click **Submit**.
6. **Back to n8n.** Go back to the **n8n** tab.
   Now go back to n8n. The form step has a green check: the request came in.

### 2. Add an If

7. **Add the next step.** Click the **+** on the right of **On form submission**.
   Big jobs should go to the owner, and everything else into the log. That is a yes or no question, which is what the If node is for.
8. **Search for If.** In **Search nodes...**, type **if**.
   Search for if.
9. **Pick If.** Choose **If**: *Route items to different branches (true/false)*.
   It sends each item down one of two branches: true, or false.
10. **Drag in the budget.** Under **Conditions**, the first box is **value1**. Drag **Budget** from the input on the left into it. (Here, click **Budget**.)
    The condition reads like a sentence: value 1, a comparison, value 2. n8n sees that it's a number and switches the comparison to Number.
11. **Open the comparison.** Open the comparison drop-down, which now says **is equal to**.
12. **Is greater than.** Point to **Number** and choose **is greater than**.
13. **Set the limit.** In **value2** (n8n fills in 0 for numbers), replace it with **1000**.
    In value 2, type 1000. So the rule is: budget is greater than 1,000.
14. **Execute step.** Click **Execute step** to try the rule on the test request.
    Try it on the test request.
15. **Check the false branch.** The request went to **True Branch (1 item)**: 2500 is more than 1000. Click **False Branch** to see the other side.
    The output shows True Branch, 1 item, because 2,500 is more than 1,000.
16. **Close the node.** Nothing went down the false branch this time. Close the node with the **×** at the top right.
    Nothing went this way this time. Each item takes one branch or the other, never both. Close the node.

### 3. Connect true and false

17. **Connect true.** The If node has two outputs, **true** and **false**. Drag from the **true** dot to **Send a message**. (Here, click the dot.)
    The If node has two outputs, true and false.
18. **Connect false.** Drag from the **false** dot to **Append row in sheet**.
    Big jobs now email the owner. Everything else goes in the log.

### 4. Add a Switch

19. **Add a step before If.** Now the owner wants emergencies sent straight to them, whatever the budget. Point to the line between the form and **If**, and click its **+** (**Add node**).
    Now the owner wants more: emergencies should reach them right away, whatever the budget. Two roads aren't enough anymore, so add a Switch in front of the If. Point to the line between the form and If, and click the plus.
20. **Search for Switch.** Type **switch**.
    Search for switch.
21. **Pick Switch.** Choose **Switch**: *Route items depending on defined expression or rules*.
    It lands on that line, so the form now feeds the Switch, and the Switch feeds the If.
22. **First rule: the service.** **Mode** is **Rules**: one rule per output. In the first rule, drag **Service** into **value1**. (Here, click **Service**.)
    Mode is set to Rules: each rule gets its own output. In the first rule, drag Service into value 1. It is text, so is equal to is right.
23. **Repair.** In **value2**, type **Repair**.
    In value 2, type Repair.
24. **Rename Output.** Outputs are numbered 0, 1, 2 until you name them. Switch on **Rename Output**.
    Outputs are just numbered 0, 1, 2 until you name them. Switch on Rename Output.
25. **Name it.** In **Output Name**, type **Repair**.
    Name it Repair.
26. **Add Routing Rule.** Click **Add Routing Rule**.
27. **Second rule.** Drag **Service** into the new rule's **value1**. (Here, click **Service**.)
28. **Emergency.** In **value2**, type **Emergency**.
    This time, type Emergency.
29. **Rename Output.** Switch on **Rename Output**.
30. **Name it.** In **Output Name**, type **Emergency**.
    And name it Emergency.
31. **Add option.** What about installations and anything else? Under **Options**, click **Add option**.
    What about installations, or anything else? By default, items that match no rule are dropped. Under Options, click Add option.
32. **Fallback Output.** Choose **Fallback Output**.
33. **Open Fallback Output.** It starts at **None (default)**: items that match no rule are ignored. Open the drop-down.
    It starts at None, which means those items are ignored.
34. **Extra Output.** Choose **Extra Output**: *Items will be sent to the extra, separate, output*.
    Now anything that matches no rule gets its own output, called Fallback.
35. **Execute step.** Click **Execute step** to route the test request.
36. **Close the node.** The Installation request matched neither rule, so it landed in **Fallback (1 item)**. Close the node with the **×**.
    The installation matched neither rule, so it went to Fallback, 1 item. That is exactly why the fallback is there. Close the node.

### 5. Wire it up and publish

37. **Connect Emergency.** Repair is already connected to **If**, so repairs still get the budget check. Drag from **Emergency** to **Send a message**. (Here, click the dot.)
    Repair is already connected to the If, so repairs still get the budget check.
38. **Connect Fallback.** Drag from **Fallback** to **Append row in sheet**.
39. **Publish.** Every route has somewhere to go. Click **Publish**.
    Every road now leads somewhere.
40. **Publish it.** Keep the **Version name** n8n suggests and click **Publish**.
    Keep the version name n8n suggests, and click Publish. From now on, every request from the form is routed on its own.

## Frequently asked questions

**What does the If node do in n8n?**

It checks one or more conditions for each item and sends the item to its true output when they pass and to its false output when they do not. Each output can lead to different steps.

**What is the difference between the If node and the Switch node?**

The If node has two outputs, true and false. The Switch node can have as many outputs as you need, one per routing rule, plus an optional fallback output for items that match no rule.

**What happens to items that match no rule in a Switch node?**

By default they are ignored. Add the Fallback Output option and set it to Extra Output to send them to a separate Fallback output, or to one of your existing outputs.

**Is this course really free?**

Yes. Stepthrough is completely free, and the practice copy needs no accounts. To build it for real you need your own n8n and Google accounts, and some of those cost money once you use them for real work.

[Start this module free](https://learn.ynteractive.com/modules/n8n-if-switch)

- Previous in n8n Automation Toolkit: [n8n: Execute Step, Execute Workflow and Publish](https://learn.ynteractive.com/content/n8n-execute-step-execute-workflow-publish)
- Next in n8n Automation Toolkit: [n8n: Talk to Your Google Sheets with ChatGPT, from Zero (Free Credits or API Key, Google, Sheet, Chat)](https://learn.ynteractive.com/content/n8n-talk-to-google-sheets-chatgpt-ai-agent)

## More in n8n Automation Toolkit

- [Find and Use n8n Templates](https://learn.ynteractive.com/content/find-and-use-n8n-templates): Skip the blank canvas. Find a ready-made workflow in the n8n template gallery, import it into your workspace, connect Google Sheets and Gmail, test it with a real form…
- [Litescrape in n8n: Swap SerpApi for a Cheaper Search API](https://learn.ynteractive.com/content/litescrape-n8n-serpapi-alternative): Switch a weekly n8n competitor-price workflow from SerpApi to Litescrape's Google Shopping API: change the HTTP Request URL, move the key into a Bearer Auth credential…
- [n8n: Weekly Client Status Emails from a Google Sheet, Written by AI](https://learn.ynteractive.com/content/weekly-client-status-email-google-sheets-ai-n8n): Build an n8n workflow that wakes up every Monday, reads your client tracker in Google Sheets, has AI write a friendly update for each client and saves it as a Gmail…
- [n8n: Turn Meeting Notes into Action Items in a Google Sheet](https://learn.ynteractive.com/content/meeting-notes-to-action-items-google-sheets-ai-n8n): Build an n8n workflow that reads your meeting notes from a sheet, has AI pull out who agreed to do what by when, and adds one row per task to an Action Items sheet.

[All 7 modules in n8n Automation Toolkit](https://learn.ynteractive.com/content/course/n8n-automation-toolkit)

## More n8n tutorials

- [n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets](https://learn.ynteractive.com/content/n8n-ai-agent-tutorial-google-sheets): Build an AI agent for BrightPath Marketing that generates social media post ideas and saves them to Google Sheets — chat trigger, AI Agent, system prompt, model…
- [Lovable + n8n: Build a Web App with an AI Backend](https://learn.ynteractive.com/content/lovable-n8n-web-app-ai-backend): Build a contact form in Lovable and connect it to an n8n workflow — webhook trigger, AI Agent, Google Sheets, Gmail, and a Respond node that ties it all together.
- [AI Receipt Extractor: Receipts to Google Sheets with n8n](https://learn.ynteractive.com/content/ai-receipt-extractor-n8n-google-sheets): Drop a photo of a receipt into an n8n chat. An AI agent reads it, pulls out the date, vendor and amount, picks a category, and adds a row to Google Sheets.
- [n8n AI Email Responder: Draft Gmail Replies Automatically](https://learn.ynteractive.com/content/ai-email-responder-gmail-drafts-n8n): Build an n8n agent that watches your Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send.
- [Daily Job Alerts: Email Each Tech Their Jobs from Google Sheets with n8n](https://learn.ynteractive.com/content/n8n-daily-job-alerts-google-sheets-gmail): Every morning at 7, n8n reads a plumbing company's jobs sheet, skips anything not assigned yet, and emails each job to the tech it's assigned to — customer, address…
- [Gmail AI Triage: Auto-Label Every Email and Draft Replies](https://learn.ynteractive.com/content/gmail-ai-triage-labels-drafts-n8n): Build an n8n workflow that reads each new email, sorts it as a lead, a client or an invoice with a Text Classifier, adds the matching Gmail label, and drafts a reply to…

## From the blog

- [How to Route Client Requests: AI Form, Agent or Rules](https://learn.ynteractive.com/content/blog/route-client-requests-with-ai-form-agent-or-rules): Route client requests with AI: collect clean details with a form, route by rules with n8n If and Switch, test, publish, and keep an agent for questions.

[All blog posts](https://learn.ynteractive.com/content/blog)

## Visual guide

This lesson’s key ideas as quick visual guides: swipe through the slides, or read the same guide as text.

- [n8n If and Switch Nodes: Route Requests by Rules](https://learn.ynteractive.com/content/visual/n8n-if-and-switch-nodes-route-by-rules): A visual guide to n8n If and Switch nodes: split big jobs from small ones with one condition, then route by service with named outputs and a fallback.

[All visual guides](https://learn.ynteractive.com/content/visual)

## Terms in this lesson

Plain-English definitions, each with an example from a free lesson.

[Fallback output](https://learn.ynteractive.com/content/glossary/fallback-output) · [True and false branches](https://learn.ynteractive.com/content/glossary/true-and-false-branches) · [Pinned data](https://learn.ynteractive.com/content/glossary/pinned-data) · [IF node](https://learn.ynteractive.com/content/glossary/if-node) · [Switch node](https://learn.ynteractive.com/content/glossary/switch-node) · [Append row](https://learn.ynteractive.com/content/glossary/append-row)

[The full AI glossary](https://learn.ynteractive.com/content/glossary)

## Related prompts

- [Request routing rules prompt](https://learn.ynteractive.com/content/prompts/routing-rules-plain-words-prompt): Write down who should get which request before you build it in n8n: the condition for each route, the exit names and a fallback…

[All free prompt templates](https://learn.ynteractive.com/content/prompts)

## Browse related tutorials

[n8n Automation Toolkit (7)](https://learn.ynteractive.com/content/course/n8n-automation-toolkit) · [n8n tutorials (32)](https://learn.ynteractive.com/content/tool/n8n)
