Feature Flags
What is it?
Feature flags are switches in your code that let you turn features on or off without deploying new code.
Explain like I'm 5
Why was it created?
Tying every feature change to a deployment is risky and slow. Flags were adopted to separate releasing code from turning features on.
Where is it used?
- Gradual feature rollouts
- A/B testing and experiments
- Kill switches for risky features
- Separating deploy from release
Why should developers care?
Feature flags enable safe rollouts, experiments, and quick kill-switches — common practice on modern teams.
How does it work?
Code checks a flag's value before running a feature. Flags are controlled from a config or service, so you can enable a feature for everyone, a percentage of users, or specific groups — instantly, without a deploy.
Real-world example
A team ships a new checkout behind a flag turned off, enables it for 5% of users, then ramps up — and flips it off instantly if errors spike.
Common use cases
- Controlled rollouts
- Experiments/A-B tests
- Instant kill switches
- Decoupling deploy from release
Advantages
- Release without deploying
- Instant rollback via toggle
- Enables experiments
- Targeted rollouts
Disadvantages
- Flags accumulate as clutter if not removed
- Add conditional complexity
- Need management at scale
- Stale flags cause confusion
When should you use it?
When you want to control feature exposure independently of deployments.
When should you avoid it?
For trivial changes where a flag adds needless complexity; and clean up flags once a feature is permanent.
Alternatives
Related terms
Interview questions
Beginner
- What is a feature flag?
- Why separate deploy from release?
Intermediate
- How do flags enable A/B testing?
- What problems do stale flags cause?
Senior
- How do you manage flags at scale?
- How do flags and canary deployments complement each other?
Common misconceptions
- "Feature flags are free to leave in forever" — stale flags become technical debt and should be removed once settled.
- "Flags replace testing" — they control exposure, not correctness; you still need tests.
Fun facts
- Flags let you 'deploy' code dark — shipped but switched off until ready.
- Removing obsolete flags is an ongoing discipline, not a one-time task.
Timeline
- 2010s — Feature flagging becomes mainstream with continuous delivery
Learning resources
Quick summary
Feature flags are runtime switches that turn features on or off without deploying, enabling safe rollouts, experiments, and instant kill switches.
Cheat sheet
- Toggle features without deploying
- Targeted/gradual rollouts
- Instant kill switch
- Clean up stale flags