# Feature Flags

Runtime controls that change product behavior for selected contexts, allowing teams to separate code deployment from user-facing release decisions.

- Type: practice
- Domain: Delivery & agility
- Level: Intermediate
- Last reviewed: 2026-09-21
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/feature-flags/>)

## What it means

Feature flags, also called feature toggles, route users or requests between code paths according to configuration and context. A flag can hide incomplete work, progressively expose a release, support an experiment, grant a permission, or disable risky behavior. The control is evaluated without requiring a new deployment for every change.

## Why it matters

Separating deployment from release reduces the pressure of all-or-nothing launches. Teams can integrate code earlier, expose changes to a small audience, observe operational and product signals, and stop a rollout quickly. Flags also let product and engineering coordinate release timing without maintaining long-lived branches.

## When to use it

Use flags for progressive delivery, short-lived release control, experiments, operational kill switches, or entitlement rules. Choose the simplest mechanism that meets the risk. A permanent business rule may deserve an explicit policy or permissions system rather than an ambiguously named boolean toggle.

## How it works

1. Define the flag’s purpose, owner, safe default, target population, and intended removal date.
2. Place the decision at a well-understood boundary and preserve secure server-side enforcement where needed.
3. Test important enabled, disabled, fallback, and interaction states.
4. Release gradually using cohorts or percentages while monitoring technical and product outcomes.
5. Provide fast rollback and audit changes to sensitive flag configuration.
6. Remove temporary flags and dead code promptly after the decision is complete.

## A practical example

A marketplace deploys a redesigned checkout behind a release flag. Employees use it first, then one percent of eligible buyers. The team watches payment errors, latency, completion, and support contacts. It pauses exposure after a regional tax issue, fixes it, and resumes without reverting unrelated code.

## Where it breaks

Every flag adds states that can interact and become difficult to test. Client-visible flags may leak upcoming features or be manipulated, and a remote flag service can become a dependency. Stale toggles create code complexity, so ownership and cleanup are essential rather than optional housekeeping.

## Common mistakes

- Creating flags without an owner, expiry condition, or cleanup task.
- Assuming a client-side flag provides authorization or protects confidential code.
- Rolling out without monitoring guardrails or a tested fallback.
- Allowing many overlapping flags to create untestable combinations.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/feature-flags/#visualization-feature-flags>)

## Sources

1. [Feature Toggles \(aka Feature Flags\)](<https://martinfowler.com/articles/feature-toggles.html>) — Martin Fowler · Foundational technical article
2. [OpenFeature Specification](<https://openfeature.dev/specification/>) — OpenFeature · Open standard specification

## Related topics

- [Continuous Delivery](<https://wiki.soroush.uk/topic/continuous-delivery/>)
- [Experimentation](<https://wiki.soroush.uk/topic/experimentation/>)
- [A/B Testing](<https://wiki.soroush.uk/topic/a-b-testing/>)
