StackLift
All terms

Glossary

Feature flags

Switches in code that turn a feature on or off for some or all users without deploying again.

Feature flags, also called feature toggles, are conditions in code that turn a feature on or off at runtime without a new deployment. They separate deploying code from releasing a feature, so you can ship unfinished work safely, roll a feature out to a small group first and switch it off instantly if something breaks.

A flag can be a simple on-off switch, a percentage rollout or a rule based on user, plan or region. Flags are managed in a config file, a database or a dedicated flag service.

They need housekeeping. Old flags left in the code add complexity, so each short-lived flag should have an owner and a removal date.

Start in 60 seconds

Put this to work on your project.

Get an AI-assisted, architect-reviewed scope, cost range, and timeline. Free, no login.

The complete guide

Feature flags: the complete guide

Updated November 18, 2026 ยท Published by , Founder, StackLift AI. Written with AI assistance; how we make content.

Short answer

Feature flags are switches in code that turn a feature on or off at runtime, without a new deployment. They separate deploying code from releasing a feature, so teams can ship unfinished work safely, roll a change out to a small group first, and switch it off in seconds if something breaks.

What are feature flags?

A feature flag, also called a feature toggle, is a condition in your code that decides whether a piece of behavior runs. If the flag is on for a user, they see the new checkout. If it is off, they see the old one. The decision is read at runtime from a config file, a database or a flag service, so changing it does not require building and deploying again.

The important idea is separation. Deploying means the code is running in production. Releasing means users can see the feature. With flags, those are two different events, often days apart, made by different people.

Why do feature flags matter for a software project?

Without flags, every release is a bet. The code ships and everyone gets it at once, and the only undo is a rollback of the whole deployment. That pushes teams toward big, infrequent, nervous releases, which are the riskiest kind.

  • Small changes can merge to the main branch every day, even when the feature is not finished, because the unfinished part stays off.
  • A release becomes a business decision, not an engineering event. Marketing can pick the day.
  • A problem in one feature can be switched off without undoing unrelated fixes in the same deployment.
  • You can show a feature to staff, then beta users, then everyone.
  • Experiments become possible: two versions, measured side by side.

Flags complement CI/CD rather than replace it. CI/CD gets code to production safely and often. Flags control who sees it once it is there.

How do feature flags work, step by step?

  1. Wrap the new behavior in a check, such as if the flag is on for this user, run the new path.
  2. Define the flag with a name, a default value, an owner and a planned removal date.
  3. Deploy with the flag off. The code is live but invisible.
  4. Turn the flag on for your team and test in production conditions.
  5. Widen the audience in stages: a small group, a percentage of users, then everyone.
  6. Watch errors, performance and business metrics at each stage, and switch off if they worsen.
  7. When the feature is fully released, delete the flag and the old code path.

The last step is the one teams skip, and it is where most flag problems start.

What types of feature flags are there?

Common kinds of flags and how long they live
TypeWhat it doesLifespan
Release flagHides unfinished or newly shipped work until you are readyShort: days or weeks
Experiment flagSplits users between variants to compare resultsShort: until the test ends
Ops flag (kill switch)Turns off a heavy or risky feature during an incidentLong: can stay for years
Permission flagGives a feature to a plan, a customer or a roleLong: part of the product
Config flagChanges a limit or setting without a deployLong

Treat these differently. Release and experiment flags are debt the day they are created and need a removal date. Ops and permission flags are part of the system and deserve tests and documentation like any other feature.

How do you roll out a feature with flags?

Rollout strategies
StrategyHow it worksGood for
Internal firstOn for staff accounts onlyCatching obvious problems with real data
Beta listOn for named customers who opted inFeatures that need feedback
Percentage rolloutOn for a growing share of users, chosen by a stable hash of the user idRisky or high-traffic changes
Targeted ruleOn by region, plan, device or account ageStaged launches and regional rules
Kill switchOn for everyone, with a fast offThird-party calls and heavy jobs

A percentage rollout should be sticky: the same user keeps the same experience across visits. Use a hash of a stable id, not a random roll on each request, or people will see the feature flicker on and off.

What are real-world examples of feature flags?

  • A SaaS product shows a new billing page to staff, then to ten customers who asked for it, then to everyone.
  • An online store turns off a recommendation widget during a traffic spike because it calls a slow third-party service.
  • A healthcare portal enables a new intake form only for one clinic location while the others stay on the old form.
  • A fintech app limits a new transfer type to verified accounts until the compliance team signs off.
  • A team testing an AI assistant routes a small group of users to a new model and compares answers before switching everyone.
  • A mobile app ships a feature in the store build but keeps it hidden until the marketing launch date.

That last case matters for apps. Store reviews take time and you cannot roll back instantly, so a remotely controlled flag is often the only fast off switch.

What tools and approaches do teams use?

You can start with something simple: a setting in a config file or a database table with an admin screen. That is enough for a handful of flags and one team. As flags multiply, you need targeting rules, audit logs, scheduled changes and a way to see who changed what.

Options for managing flags
OptionStrengthWatch out for
Config file or environment variableNo new dependencyChanging it usually needs a deploy or restart
Database table plus admin screenInstant changes, full controlYou build targeting, audit and caching yourself
Hosted flag services (LaunchDarkly, Statsig, PostHog, Unleash)Targeting, experiments, audit trailsAnother vendor, and an outage path to plan for
OpenFeature standardA vendor-neutral API so you can switch providersYou still need a provider behind it
Platform built-ins (Vercel Flags, AWS AppConfig)Close to the hosting platformTied to that platform

How do you adopt feature flags well?

  1. Pick one risky or visible feature to flag first, not the whole codebase.
  2. Choose where flags live and who can change them in production.
  3. Name flags by what they do and give each an owner and a removal date.
  4. Define a safe default so that if the flag service is unreachable, the app behaves sensibly.
  5. Test both paths, on and off, in your automated tests.
  6. Log which flag state each user saw, so bug reports can be reproduced.
  7. Review the flag list on a schedule and delete what is finished.

Keep the check close to the edge of the feature. One flag read in one place is easy to remove. The same flag scattered across thirty files is not.

What are the common feature flag mistakes?

Mistakes and how to avoid them
MistakeConsequenceAvoidance
Never removing flagsDead code paths, confusing logic, hidden bugsRemoval date and a cleanup review
Nested flags that depend on each otherCombinations nobody testedKeep flags independent, and limit how many can be on together
Testing only the on stateThe old path breaks while it is still liveTest both states in CI
No audit trailNo one knows who turned a flag on during an incidentLog every change with a name and time
Using flags as access controlA client-side flag exposes data to anyoneEnforce permissions on the server, always
Slow flag lookupsA remote call on every request adds latencyCache values and refresh in the background

The access-control point deserves emphasis. A flag that hides a button does not protect an endpoint. Keep security checks on the server, independent of any flag.

How do you measure whether feature flags are working?

Look at the process, not just the tool. Healthy signs include smaller, more frequent deployments, faster recovery when something goes wrong because the first response is a switch, and a flag list that stays short because old flags get removed.

Per rollout, tie each flag to the metrics that would show harm: error rate, latency, support contacts and the business number the feature is meant to move. Good observability lets you filter those metrics by flag state, so you can see whether users with the feature are better or worse off.

What do feature flags mean for cost and timeline?

A simple flag setup is a small piece of work, usually part of the first sprints. Effort grows with targeting rules, an admin screen, audit logging, experiments and the number of platforms involved, such as web, mobile and backend services. A hosted service trades build time for a subscription.

Flags also carry a running cost: every flag adds a branch to test and later remove. For sizing a project that includes release tooling and DevOps, see the cloud and DevOps cost page and the free estimate.

How StackLift approaches feature flags

Release control is part of the delivery plan from sprint one, alongside CI/CD, observability, security review and rollback. Agents work on feature branches and never push to the default branch or touch production secrets, and a senior engineer reviews what ships.

Where a feature needs a staged rollout, flags are scoped as part of that feature. Your team sees live project state, approvals and releases in the client portal, so you know what is deployed and what is switched on. See the production readiness checklist and delivery operations.

Questions people ask

What is the difference between a feature flag and a feature toggle?

Nothing in practice. Both names describe a runtime switch that turns behavior on or off. Toggle is the older term, and flag is now more common.

Do I need a feature flag service?

Not at first. A config value or a database table works for a few flags. A service pays off when you need user targeting, experiments, audit history or non-engineers changing flags.

Are feature flags the same as A/B testing?

No. A/B testing is an experiment that compares two versions and measures results. Flags are the mechanism that often powers it, but flags are also used for plain rollouts and kill switches.

Can feature flags slow down my app?

A remote lookup on every request can. Good setups cache flag values in memory and refresh them in the background, so the check costs almost nothing.

How many feature flags is too many?

There is no fixed number. The warning sign is flags nobody can explain. If you cannot say who owns a flag and when it will be removed, it is already too many.

Should feature flags be used for security?

No. A flag controls what is shown or run, not who is allowed to do it. Enforce permissions on the server, then use flags only for rollout.

How do feature flags help with mobile apps?

Store releases are slow and cannot be recalled instantly. A remote flag lets you ship code in the build, enable it when ready and switch it off if there is a problem.

How do you remove an old flag safely?

Confirm the feature is on for everyone and stable, delete the check and the old code path in one small change, and let your tests and review catch anything that still depended on it.

Sources

Sources and further reading

The standards, rules, research and official documentation this page draws on.