> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-flags/use-feature-flags/use-ff/ff-creating-flag/create-a-feature-flag.md).

# Create a Feature Flag

Feature Flags allow you to toggle features in your code on or off, which allows you to progressively roll out features to particular users or groups. By using Feature Flags, you can manage continuous delivery and control who sees which features and when.

This topic describes how to create a Feature Flag in the Harness platform.

A Feature Flag is available only for the project the flag is created in, so you’ll need to create any relevant flags you want to use in each project you want to use them for.

You can use the same flags across multiple environments within a single project, but the flag status in each environment is independent.

### Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

Before you create a Feature Flag, you must have [completed the prerequisites](/feature-flags/use-feature-flags/use-ff/ff-creating-flag/create-a-project.md), that is:

1. Created a project
2. Created an environment
3. Created an SDK key

### How Feature Flag variations work <a href="#how-feature-flag-variations-work" id="how-feature-flag-variations-work"></a>

When you create a Feature Flag, you also create different options to label the logic of that flag. These are called flag variations. For example, a simple boolean flag has only two variations, `true` and `false`.

There are two different types of Feature Flags you can create:

* **Boolean**: Has only two variations; true and false.

  ![Diagram showing the on and off variation of a boolean feature flag.](/files/bjfvI1JCb8qlMPqrOLPt)
* **Multivariate**: Has multiple variations, you can add as many custom variations as you like.

  ![Diagram showing three variations (a 30 variation, 60 variation, and 90 variation) of a multivariate Feature Flag.](/files/Moa33hFxQ3XSYoHsRDvu)

### Create a boolean flag <a href="#create-a-boolean-flag" id="create-a-boolean-flag"></a>

1. In **Feature Flags**, click **+ New Flag**.
2. Select **Boolean**.
3. In **About the Flag**, in **Name**, enter a name for your flag and click **Next**.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>When you name a flag, Harness automatically generates its identifier. You can edit the identifier when you are creating the flag, but not after it is saved. If you rename the flag, the identifier remains the same. For more information, go to <a href="/spaces/3F2TpHXhur2QtQnORSM9/pages/P3rl2CRrbrLsJ1qWoyDD">Entity Identifier Reference</a>.</p></div>
4. To make the Feature Flag permanent, select the **This is a permanent flag** checkbox. Permanent flags are flags you intend to stay in your system indefinitely, so we will never mark them as potentially stale.
5. Click **Next**.
6. In **Variation settings**, in **Flag Type**, select **Boolean**.
7. In the **Name** fields, enter the name for the true and false variations, for example, **True** and **False**.
8. In **Default rules for the flag**, select which variation of the flag to serve when the flag is ON or OFF, for example, True when the flag is ON and False when the flag is OFF.

   <figure><img src="/files/0yn3z8nYdyN0OH0oeqim" alt="A screenshot of the Variation Settings form when creating a Feature Flag."><figcaption></figcaption></figure>
9. Click **Save and Close**. The Feature Flag is created and is set to **OFF** by default.

   ![A screenshot of the Feature Flags page with the new flag added.](/files/UE5sfVPnrFwda1Vs03Eu)

After you have created your Boolean flag, you can:

* [Manage the variations of the Feature Flag](/feature-flags/use-feature-flags/use-ff/ff-creating-flag/manage-variations.md)
* [Add flag prerequisites](/feature-flags/use-feature-flags/use-ff/ff-creating-flag/add-prerequisites-to-feature-flag.md)
* [Target users with flags](/feature-flags/use-feature-flags/use-ff/ff-target-management/targeting-users-with-flags.md)

### Create a multivariate flag <a href="#create-a-multivariate-flag" id="create-a-multivariate-flag"></a>

Multivariate Feature Flags allow you to serve a different variation of a flag to multiple user groups at one time. For example, a multivariate flag could have the following variations:

* Variation 1 set to OFF
* Variation 2 set to ON
* Variation 3 set to be served only when a user has a certain email address

There is no limit to the number of variations that you can add to a multivariate flag, and you can use strings, numbers, or JSON to define the different Variants.

To create a multivariate flag:

1. In **Feature Flags**, click **+ New Flag**.
2. Select **Multivariate**.
3. In **About the Flag**, in **Name**, enter a name for your flag and click **Next**.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>When you name a flag, Harness automatically generates its identifier. You can edit the identifier when you are creating the flag, but not after it is saved. If you rename the flag, the identifier remains the same. For more information, go to <a href="/spaces/3F2TpHXhur2QtQnORSM9/pages/P3rl2CRrbrLsJ1qWoyDD">Entity Identifier Reference</a>.</p></div>
4. To make the Feature Flag permanent, select the **This is a permanent flag** checkbox. Permanent flags are flags you intend to stay in your system indefinitely, so we will never mark them as potentially stale. For example, if you are offering a premium feature to some of your customers but not others, you can use a permanent flag to manage who sees this feature indefinitely.
5. In **Variation settings**, in **Flag Type**, select **Multivariate** and then select the **Data Type**. You can select, **String**, **JSON**, or **Number**.
6. Enter a **Name** and **Value** for each variation you want to use.
7. In **Default rules for the flag**, define which variation you will see by default when the flag is ON or OFF.

   <figure><img src="/files/NJXiwhXKsmZi2vc7YvfV" alt="A screenshot of the Variation Settings form when creating a Feature Flag."><figcaption></figcaption></figure>

After you have created your multivariate flag, you can then:

* [Change the Variations of the Feature Flag](/feature-flags/use-feature-flags/use-ff/ff-creating-flag/manage-variations.md)
* [Add Flag Prerequisites](/feature-flags/use-feature-flags/use-ff/ff-creating-flag/add-prerequisites-to-feature-flag.md)
* [Target Users with Flags](/feature-flags/use-feature-flags/use-ff/ff-target-management/targeting-users-with-flags.md)
