A feature flag is a conditional in your code that shows a feature to some users and hides it from others. It's also called a feature toggle or feature switch. You deploy the code, but the feature stays off until you're ready to enable it.
The core use case is safe releases. Merge the code, deploy it, flip the flag when you're ready. If something goes wrong, flip it back. No rollback, no hotfix, no incident at 2am.
What else they're good for
Feature flags enable a lot beyond safe deploys:
- Percentage rollouts, show to 5% of users, then 20%, then 100%
- Beta testing without a separate environment
- A/B tests on the same codebase
- Tiered feature sets for different plans or enterprise customers
- Soft launches to a single customer while you finish polishing
Separating "code is deployed" from "feature is live" means your deployment pipeline can run more frequently, which reduces risk on every deploy. Continuous delivery stops feeling dangerous.
The downside: flag debt
Every flag you create is a branch in your logic that you'll eventually have to clean up. Make flag removal part of your definition of done. When a feature goes fully live, the flag comes out.
Tie your roadmap milestones to specific flags so you always know exactly what's live for who.