---
title: Create a Feature Gate
description: "This guide walks through how to create a Feature Gate in the Statsig console, how to add an evaluation rule to a Feature Gate, how to implement the Feature Gate in your code, examples of common Feature Gate setups, and a list of all Feature Gate targeting conditions available in Statsig."
product: general
token_estimate: 1453
---
# Create a Feature Gate

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## In the Statsig console

### Create a new feature gate

1. Log into the Statsig console at https://console.statsig.com.
2. On the left-hand navigation panel, under **Feature Management**, select **Feature Gates**.
3. Click on the **Create** button.
4. Enter the name and description of the Feature Gate you want to create. Name your gate based on what you're rolling out, such as "Zippy Home Page" for a new homepage.

![Feature gate creation form](https://docs.statsig.com/images/feature-flags/create/a14bc4f3-b768-4e6c-a84a-7bae449b2c7c.png)

5. Click **Create** to complete creating your Feature Gate.
6. You have created a new Feature Gate without any evaluation rules or conditions.

   ![Newly created feature gate without rules](https://docs.statsig.com/images/feature-flags/create/64a7bc9a-bd3e-4d98-a853-4f91f16ef82e.png)

   ### Add a rule to your feature gate

   By default, a Feature Gate returns `false` when there are no rules configured. Statsig blocks all users from seeing the feature until you set rules for who gets to "pass". The following steps walk through adding evaluation rules or conditions for a Feature Gate.

   1. In Statsig console, under **Feature Management**, select **Feature Gates**.
   2. Select the feature gate where you want to add a targeting rule.
   3. Click the **+ Add New Rule** button.

   ![Add rule button interface](https://docs.statsig.com/images/feature-flags/add-rule.png)

   4. Name your rule with something descriptive that other teammates understand, such as "Mobile Users Only".
   5. Configure your Feature Gate with the following options:

   - **Environment(s)**: The [staging environment(s)](https://docs.statsig.com/guides/using-environments) you want your gate to apply to
   - [**Criteria**](https://docs.statsig.com/feature-flags/conditions): Specific evaluation conditions for the rule. Learn more about [criteria and condition evaluation](https://docs.statsig.com/feature-flags/conditions).
   - **Split %**: The percentage of users who meet the criteria that you want to pass or fail the gate check. Statsig automatically calculates the Fail % based on the Pass % you set.
   - [**Overrides**](https://docs.statsig.com/feature-flags/overrides): A list of users you want to always bypass your gate (an allow list)

   6. Statsig doesn't auto-save changes to Feature Gates and targeting rules. Select **Save** at the bottom right when you're ready for your changes to take effect.

   Statsig evaluates rules top to bottom and applies the first match, so [rule order matters](https://docs.statsig.com/feature-flags/conditions). To reorder rules, drag a rule by its `IF` / `ELSE IF` rail to a new position; to add a rule at a specific spot, hover between two rules and click **Insert new rule**.

   ## In your code

   The previous steps covered setting up Feature Gates in the web console. For these gates to impact the behavior of your application, you also need to update your product code. The Statsig SDK handles the evaluation so that gate decisions take effect in real time.

   ### Initialize the Statsig SDK

   If you haven't already initialized the Statsig SDK, follow the [Installation Steps](https://docs.statsig.com/client/React#installation) in the language of your choice.

   ### Check a feature gate

   Use the `checkGate` function in the Statsig SDK. You can find a code snippet for any particular gate on that gate's page in the Statsig console. Select the code snippet button, then select the SDK you want to use.

   ![Gate code snippet button](https://docs.statsig.com/images/feature-flags/create/b52add6e-4352-4be4-b902-56d77a33d28b.png)

   Here's an example in [React](https://docs.statsig.com/client/React#basics-check-gate):

   ```tsx
   const { client } = useStatsigClient();
   return (
     <div>Gate is {client.checkGate("example_gate") ? "passing" : "failing"}.</div>
   );
   ```

   In this example, the Statsig SDK checks from a client app whether you set up any rules named "Example Gate". Statsig renders the text "Gate is passing" for users who pass your gate conditions, and "Gate is failing" for users who fail the gate conditions.

   > **Tip:**
   >
   > Statsig offers over 20 client and server-side SDKs. Go to the full list of [SDKs](https://docs.statsig.com/sdks/quickstart#all-sdks) to find the one that best fits your needs.

   ## Common feature gate setups

   ### Kill switches

   Set up a kill switch by setting an `Everyone` criteria's Pass percentage to 100%. To completely disable the feature for all users after code deployment, set the Pass percentage to 0%.

   ### OS-based flags

   You can target users based on common application properties such as the operating system that the application is running on. For example, to target iOS users only, you can create a rule with the "Operating System" criteria, the "Any of" operator, and then listing "iOS" in the text field.

   ### Internal employees only

   You can target users based on known user attributes. For example, you can use the user's **Email** attribute and the **Contains any of** operator, then enter the email domain of your company to target only internal employees.

   ### Defined user segments

   You can also target users in a defined user [Segment](https://docs.statsig.com/segments/overview).

   ### Parent/child flags

   You can target users based on their eligibility of other Feature Gates, enabling powerful chaining, hierarchy, and dependencies of flags. [Flag lifecycle management](https://docs.statsig.com/feature-flags/feature-flags-lifecycle) makes it easy to manage, deprecate, and maintain dependent flags.

