What is branching logic?

Branching logic lets you create different paths through your form. Based on a respondent’s answer, you can send them to a specific question, Question Group, or Ending instead of following the default order.

Use branching logic to:

  • Ask only questions that are relevant to each respondent
  • Skip questions or sections that don’t apply
  • Create different paths for different audiences
  • Send respondents to different Endings.
HC_Note_new.png
Note! You can set up Logic in the desktop builder. Logic isn’t available in the mobile builder.

Branching logic and other Logic tools

Use Branching when you want an answer to change what respondents see next. For example, you could send existing customers to one set of questions and new customers to another.

Other Logic tools in Typeform are better for different goals:

  • Hide questions: hides individual questions when they aren’t relevant, based on previous answers or URL parameters.
  • Hide answer choices: removes answer choices that don’t apply in a later question.
  • Calculations: calculates points, totals prices, or performs other basic calculations.
  • Scoring: adds points and uses the total score to determine the result.
  • Outcome quiz: links answer combinations to different Endings.

For help choosing the right tool, see Which type of Logic should I use, and where can I find it?

Where to access branching logic

From the Content panel

Open your form and select a question.

Click Logic in the right side panel.

Select Branching, then add or edit a rule.

For question types with selectable answers (Multiple Choice, Picture Choice, Yes or No, or Legal) you can also click the branching icon beside an answer choice to set a destination directly.

From the Workflow panel

Open the Workflow panel and select Logic.

Select the question where you want to add branching.

Add or edit a Branching rule.

You can also click on a question in the Logic Map to open its Logic settings. The Logic Map helps you visually review the structure of your form and troubleshoot complex flows. 

Example: send respondents down different question paths

Let’s say you want to ask different questions to cat and dog lovers. 

An animated diagram showing conditional branching where a form splits into separate paths for a cat person and a dog person.

1. In our example, we’ll set up branching logic from the Content tab. We’ve added a Multiple Choice question to ask respondents if they’re a dog or a cat person, and then two Question Groups, one for cat questions and one for dog questions.

Form content outline showing a Multiple Choice question followed by two distinct Question Groups labeled Cat Questions and Dog Questions.

HC_Note_new.png
Note! Using Question Groups is optional. You can also just set the branching so that each answer choice sends respondents straight to a specific next question, allowing you to skip them past any questions you don’t want them to see.

2. If respondents say they’re a cat person, we want them to see the questions about cats, and if they say they’re a dog person, we want them to see the questions about dogs.

We’ll click on the Add branching icon next to the Cat answer option.

A close-up view of the Multiple Choice question focusing on the branching icon next to the Cat answer choice.

3. We'll add a rule for the first answer choice. For example: Go to the Cat questions when “Are you a cat or a dog person?” is “Cat”.

4. We'll add a second rule that sends respondents to the Dog questions when they answer "Dog", then we'll click Save.

5. Next, we want to add logic to the last question in the first Question Group (about cats). Since the last question in our Cat Question Group is a Number question, it doesn’t have selectable answers, so it won’t display the branching icon beside answer choices. Instead, we’ll click on Logic in the right-hand sidebar to set up the rule.

6. We’ll add a rule on this question to Always go to Default end. This way, after the cat person completes the cat questions, they’ll skip over the dog questions and see the Default end screen.

Now we want to check that the logic branching that we've set up looks correct. We’ll click on the Workflow tab to see the Logic Map. Your Logic Map will display the different paths a respondent can take in your form.

You can click Logic from the Workflow tab (or click directly on any question in the Logic Map) to edit the logic you've set up.

How branching rules work

A branching rule follows this pattern:

Go to [destination], when [condition]

The destination can be a question, Question Group, or Ending.

A condition is what Typeform checks before choosing a path. Usually, it checks a respondent’s answer to an earlier question, for example, whether they selected “Cat.” Depending on your setup, it can also check information passed in URL parameters or a value calculated in your form. 

If you add more than one rule, put the rules in the order you want them evaluated. The first condition that’s met triggers the jump, so later rules won’t be used for that respondent.

When you combine conditions, make sure the scenario is possible. For example, a respondent can’t answer “Cat” and “Dog” to the same single-answer question. See Using and/or with Logic for more guidance.

Tips for building with branching logic

  • Sketch the paths before you start, especially if your form has several branches.
  • Use Question Groups to keep related questions together.
  • Add a destination for all other cases when respondents who don’t meet a condition need a specific path.
  • Test every answer path in Preview before you share your form.
  • If your Logic isn’t behaving as expected, see Logic not working? Here are 5 ways to fix it.

Was this article helpful?

Have more questions? Submit a request

Tap into our community knowledge

Find answers

Can’t find what you’re looking for?

Contact support