# Getting started with feature flags - Docs

## Create your first flag

A feature flag lets you toggle a feature on or off without redeploying code. To get started, install the PostHog SDK for your platform and create your first flag in the PostHog UI.

### Platforms

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/dotnet_logo_7e446176f2.svg).NET](/docs/feature-flags/installation/dotnet.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/Android_robot_bec2fb7318.svg)Android](/docs/feature-flags/installation/android.md)

-   [API](/docs/feature-flags/installation/api.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/elixir.svg)Elixir](/docs/feature-flags/installation/elixir.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/flutter.svg)Flutter](/docs/feature-flags/installation/flutter.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/go.svg)Go](/docs/feature-flags/installation/go.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/ios.svg)iOS](/docs/feature-flags/installation/ios.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/java.svg)Java](/docs/feature-flags/installation/java.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/nodejs.svg)Node.js](/docs/feature-flags/installation/nodejs.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/php.svg)PHP](/docs/feature-flags/installation/php.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/python.svg)Python](/docs/feature-flags/installation/python.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/react.svg)React](/docs/feature-flags/installation/react.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/react.svg)React Native](/docs/feature-flags/installation/react-native.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/rr_logo_light_970950178e.svg)React Router](/docs/feature-flags/installation/react-router.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/ruby.svg)Ruby](/docs/feature-flags/installation/ruby.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/rust.svg)Rust](/docs/feature-flags/installation/rust.md)

-   [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/js.svg)Web](/docs/feature-flags/installation/web.md)

> **New to feature flags?** Check the [overview page](/docs/feature-flags.md) for a primer on use cases like phased rollouts, kill switches, targeting, and remote config.

[Install PostHog SDK](/docs/feature-flags/installation.md)

## Add flag code to your app

Once the SDK is installed, [create a feature flag](/docs/feature-flags/creating-feature-flags.md) in PostHog and then check it in your code. The basic pattern looks like this:

JavaScript

PostHog AI

```javascript
// Check a boolean flag
if (posthog.isFeatureEnabled('my-new-feature')) {
    // Show the new feature
}
// Get a multivariate flag value
const variant = posthog.getFeatureFlag('signup-flow')
if (variant === 'test') {
    // Show the test variant
}
```

You can also use [payloads](/docs/feature-flags/remote-config.md) to send JSON configuration alongside your flags, and [multivariate flags](/docs/feature-flags/creating-feature-flags.md#multivariate-feature-flags) to test multiple variants.

[See all SDKs and code examples](/docs/feature-flags/adding-feature-flag-code.md)

## Test and roll out

Before going live, test that your flag behaves correctly. PostHog gives you several ways to test and roll out safely:

-   **Override for yourself** — Target your email or user ID to see each variant

-   **Phased rollout** — Start at 5-10% of users, monitor metrics, then gradually increase

-   **Target by properties** — Show features to specific users, cohorts, or groups

-   **Set up dependencies** — Make flags depend on other flags for complex rollout strategies

    ![Feature flag creation UI](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/create_feature_flags_light_133081fabc.png)![Feature flag creation UI](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/create_feature_flags_dark_8aaa86aa47.png)

    [Learn about testing flags](/docs/feature-flags/testing.md)

## Use with experiments

Feature flags power PostHog's [A/B testing and experimentation](/docs/experiments.md) platform. When you create an experiment, PostHog automatically creates a feature flag to split users into control and test groups, then tracks your goal metric to determine statistical significance.

This means you can:

-   Run A/B tests on any feature you've flagged

-   Track conversion, revenue, or custom metrics per variant

-   Get statistically significant results before rolling out to everyone

-   Use [holdout groups](/tutorials/holdout-testing.md) to measure long-term impact

    [Run your first experiment](/docs/experiments/start-here.md)

## Use for free

PostHog's feature flags are built to be cost-effective, with a generous free tier and transparent usage-based pricing. Since we don't charge per seat, most companies use PostHog for free.

## TL;DR

-   No credit card required to start
-   First 1M API requests per month are free
-   Above 1M we have usage-based pricing with volume discounts
-   Set billing limits to avoid surprise charges
-   Use our [pricing calculator](/docs/feature-flags/cutting-costs.md) to estimate costs

---

That's it! You're ready to start flagging features.

[Install feature flags](/docs/feature-flags/installation.md)

1/5

[**Create your first flag** ***Required***](#quest-item-create-your-first-flag)[**Add flag code to your app** ***Required***](#quest-item-add-flag-code-to-your-app)[**Test and roll out** ***Required***](#quest-item-test-and-roll-out)[**Use with experiments** ***Recommended***](#quest-item-use-with-experiments)[**Use for free** ***Free 1M requests/mo***](#quest-item-use-for-free)

**Create your first flag**

***Required***

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be better