> ## Documentation Index
> Fetch the complete documentation index at: https://docs.growthbook.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Feature Flag Fundamentals

> How feature flags work in GrowthBook: keys, values, environments, targeting rules, and default values.

This page covers the core concepts you'll need to create and configure feature flags in GrowthBook.

## Feature Keys

Every feature is defined by a unique **key**. This is what your engineering team references in code when checking the value of a feature. Feature keys **cannot** be changed after creation, so take care when choosing one. If you make a mistake, delete the feature and create a new one.

![Create Feature modal in GrowthBook](https://mintcdn.com/growthbook-ea15456d/giSZyh24PfnTkKz4/static/images/features/feature-create-feature-2.png?fit=max\&auto=format\&n=giSZyh24PfnTkKz4\&q=85\&s=3e076cb2b4c5a2f656ec5a4ca5be39ca)

> [!WARNING]
>
> **Naming Conventions**
>
> Feature keys can only include letters, numbers, and the characters `_`, `-`, `.`, `:` and `|`. Keep them short and use kebab-case unless your organization has its own format.

## Feature State

Feature flags can be enabled or disabled. When a flag is disabled, GrowthBook excludes the feature from the API response. The feature evaluates to `null` and ignores all targeting and rules. In your app, the SDK will render the feature with the fallback value.

You can enable or disable a flag from the feature page, or automate it (for example, from a deploy script) with the [toggle feature endpoint](https://docs.growthbook.io/api/features-v2/operation/toggleFeatureV2.md), which switches a flag on or off in one or more environments.

Here's an example from the JavaScript SDK:

```js theme={null}
const showNewCheckout = gb.isOn('new-checkout')
// Renders false if the feature is disabled

const buttonColor = gb.getFeatureValue('button-color', 'red')
// Renders 'red' if the feature is disabled
```

## Feature Types

Features can be a simple ON/OFF flag or a more complex data type (string, number, or JSON).

| Type | Values | Best for | Example |
| - | - | - | - |
| **Boolean** | `true` / `false` | Simple on/off toggles, kill switches, gradual rollouts | `show-onboarding-checklist` |
| **String** | Any string | Remote config, multivariate A/B tests | `button-color` set to `"red"`, `"blue"`, etc. |
| **Number** | Any integer or float | Numeric configuration values | `results-per-page` set to `10`, `25`, `50` |
| **JSON** | Any JSON object | Complex configuration, multiple values in one flag | `{"maxRetries": 3, "timeout": 5000}` |

**Boolean** flags are the most common. They're limited to two variations in A/B tests (on/off), so if you need more variations, like testing three different button colors, use a string, number, or JSON flag instead.

**JSON** flags also support JSON Schema validation, which lets you enforce the structure of the value before it reaches your application.

Enterprise

**JSON Validation**
is available on Enterprise plans.

A **JSON** flag can also be **backed by a [Config](https://docs.growthbook.io/features/configs.md)** — a reusable, typed, composable object shape you define once and enforce on every flag that uses it. Reach for one when many flags share the same structured value; changing the config updates them all. See [Configs](https://docs.growthbook.io/features/configs.md) for details.

Enterprise

**Feature Configs**
is available on Enterprise plans.

**Reusable values.** A **string** or **JSON** flag value can reference a [**Constant**](https://docs.growthbook.io/features/constants.md) — a named value (with optional per-environment overrides) defined once and resolved into the value when the SDK payload is built. See [Constants](https://docs.growthbook.io/features/constants.md).

## Default Values

Each feature has a default value that's used when there are no matching rules for the user. A feature that is enabled on an environment with no rules uses the default value. Default values match the feature type.

Default values can be overridden by [**Rules**](https://docs.growthbook.io/features/rules.md), which let you target specific users, roll out to a percentage of traffic, or run A/B experiments.

## What's Next

Now that you understand keys, types, and default values, the next concepts to explore are:

* **[Environments](https://docs.growthbook.io/features/environments.md)** — Control where a feature is active (e.g., enabled in dev but not production). Each environment has its own SDK connection and independent set of rules.
* **[Rules](https://docs.growthbook.io/features/rules.md)** — Override default values by targeting specific users, rolling out to a percentage of traffic, or running A/B experiments. See [Rule Types](https://docs.growthbook.io/features/rules.md#rule-types) for help picking the right approach.
* **[Targeting Conditions](https://docs.growthbook.io/features/targeting.md)** — Define *who* sees a rule using attributes like user ID, country, or plan type.
