A feature flag (or feature toggle) is a conditional in your code controlled by configuration rather than by a deployment. Code ships turned off, then gets enabled for specific users, percentages of traffic, or environments.
Why it matters
Flags separate deploying from releasing. You can ship code on Tuesday and enable it on Thursday, to 1 percent of users first. If monitoring shows trouble, flipping the flag off takes seconds and avoids a full rollback. That keeps the blast radius small.
Example
if (flags.isEnabled("new-checkout", { userId })) {
return renderNewCheckout();
}
return renderOldCheckout();
A rollout plan might be: internal staff, then 1 percent, 10 percent, 50 percent, 100 percent, with a pause at each step to compare error rate and latency between users with the flag on and off. This is the same idea as a canary release, applied per feature rather than per server.
Common mistakes
- Leaving old flags in the code for years. Stale flags create untested combinations and confusing behavior. Remove a flag once the rollout is done.
- Having no default for when the flag service itself is unreachable.
- Changing flags in production without an audit trail.
- Not monitoring flag changes, which makes "what changed?" harder during an incident.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.