Feature Flags

What are Feature Flags?

Feature flags are switches in code that turn functionality on or off at runtime without deploying new code, letting teams separate deployment from release, roll out changes gradually and disable problems quickly.

Updated November 2026 · 2 min read


Feature flags, also called feature toggles, are switches in code that turn functionality on or off without deploying new code. A new checkout flow can be deployed to production but switched off, then turned on for internal staff, then for 5% of customers, then for everyone, all without a new release. If something goes wrong, the flag is switched off in seconds. Feature flags separate deploying code from releasing features, which changes how teams manage risk.

Pete Hodgson's article on feature toggles, published on Martin Fowler's website in 2016, described the main types and the discipline needed to manage them. Feature flag management is now available as dedicated products and as features of many deployment platforms.

How feature flags work

In code, a flag is a conditional: before running the new checkout flow, the application asks whether the flag is on for this user. The answer comes from a configuration file, a database or a flag management service, and can depend on rules such as the user's region, plan or a percentage bucket. Changing the rule changes behavior immediately, with no build or deployment.

Types of feature flags

TypePurposeTypical lifespan
Release flagsHide unfinished or untested featuresDays to weeks, removed after launch
Experiment flagsA/B tests, showing different versions to different usersLength of the experiment
Operational flagsTurn off expensive or risky functionality under load, also called kill switchesCan be long-lived
Permission flagsEnable features for specific customers or plansLong-lived

What flags enable

  • Trunk-based development, since unfinished work can be merged safely.
  • Gradual rollouts to small groups first, similar to a canary deployment at the feature level.
  • Instant rollback without a new deployment.
  • Experiments to measure the effect of changes.
  • Business control over when features launch, independent of engineering schedules.

The risk: Flag debt

Every flag adds a branch in the code. Flags left in place after they are no longer needed accumulate into confusing, untested combinations. The most famous cautionary tale is Knight Capital in 2012. During a deployment, one of eight servers was not updated, and a repurposed flag activated old, unused trading code on that server. The firm lost more than $440 million in about 45 minutes. The lesson for flags is to remove them when they are done and never reuse old ones.

An example

Consider a hypothetical online travel company launching a new search results page. The team deploys it behind a release flag over several weeks while building it. It turns the flag on for employees, then for 2% of customers. Monitoring shows that the new page is faster but bookings drop slightly on mobile. The team keeps the flag at 2%, fixes a layout problem on small screens and rolls out to 25%, then 100%, as bookings match the old page. Two weeks after full rollout, the flag and the old page's code are removed.

Common pitfalls

  • Never removing release flags.
  • Reusing old flags for new purposes.
  • Too many flags without ownership or expiry dates.
  • Not testing combinations that matter.

Feature flags are a key technique in continuous delivery and release management.

Frequently asked questions

What kinds of feature flags do teams use?

Teams commonly use four kinds. Release flags hide unfinished features and are removed within days or weeks of launch. Experiment flags support A/B tests for the length of an experiment. Operational flags, or kill switches, turn off expensive or risky functionality under load. Permission flags enable features for specific customers or plans and are usually long-lived.

What is feature flag debt?

Flag debt is the buildup of feature flags left in code after they stop being needed. Each flag adds a branch, so old flags create confusing, untested combinations. In 2012 Knight Capital lost more than $440 million in about 45 minutes after a repurposed flag activated old trading code on one server. Removing flags when they are done and never reusing them prevents this.

How do feature flags differ from canary deployments?

A canary deployment routes a share of traffic to a new version of a service, while a feature flag controls one feature inside code that is already deployed. Flags allow gradual rollout at the feature level, similar to a canary, and can be switched off in seconds without a new deployment. Teams often use the two together.

Book a demo