How to create a feature flag in PostHog

Create a boolean feature flag in PostHog: set a key and description, release it to 100% of users, and save it so your app can toggle the feature.

Quick answer

Open Feature flags, choose Create your first feature flag, then pick Start from scratch. Enter a unique key and a description, set the Rollout percentage to 100%, and click Save. The flag is Boolean by default, so it returns true for every user in the All Users condition set.

Steps at a glance

  1. Open Feature flags and click Create your first feature flag.
  2. Choose Start from scratch.
  3. Enter the flag key.
  4. Add a description.
  5. Set the rollout percentage to 100%.
  6. Click Save.

Interactive demo

Loading demo…

Summary

A feature flag lets you ship code behind a switch and decide who sees it. PostHog flags are Boolean by default, and you control who gets the feature with a rollout percentage in the release conditions.

Step-by-step guide

  1. Step 1

    Create your first feature flag

    Open Feature flags from the sidebar. On the empty page, click Create your first feature flag to start a new flag.

  2. Step 2

    Start from scratch

    Under Create a feature flag, click Start from scratch to use the default settings and customize everything yourself.

  3. Step 3

    Enter the flag key

    Click the Flag key field and type a unique key, such as new-board-layout. Your code uses this key to check the flag.

  4. Step 4

    Add a description

    Click the Description field and describe the flag for your team, for example New board layout for Acme Tasks. The Boolean flag type is already selected.

  5. Step 5

    Release to 100% of users

    In the release conditions, find Rollout percentage for the All Users condition set. Click 100% to release the flag to everyone.

  6. Step 6

    Save the flag

    Click Save at the top of the page. The condition set now shows 100% and the flag is created.

Why this matters

You are about to ship a new board layout but want to turn it on without a redeploy. Creating the flag now gives your team one switch to release the feature to everyone, or pull it back if something goes wrong.

Frequently asked questions

  • What type of flag does this create?

    A Boolean flag, which is the default type. It is a release toggle that returns true or false based on the release conditions.

  • Can I release to fewer users first?

    Yes. The Rollout percentage offers 0%, 10%, 25%, 50%, 75% and 100%, so you can pick a lower value instead of 100%.

Create interactive demos like this one — free, no coding required.

Start for free →