
Feature flags, also called feature toggles, are switches in your software that turn a feature on or off without redeploying code. They let you ship code safely, release to a few users first, roll back in seconds and run experiments. Used well, they separate deploying from launching; used carelessly, they become a pile of forgotten switches, so give every flag an owner and a removal date.
Key takeaways
- Deploying puts code on servers. Releasing makes a feature available to users. Feature flags let you do these at different times.
- The main benefits are gradual rollouts, quick rollback, experiments, beta programmes and emergency kill switches.
- There are different kinds of flag with different lifespans: release, experiment, operational and permission flags.
- Flag debt, untested combinations and unprotected flag controls are the real risks.
- Backward-compatible database changes are what make rollback genuinely safe.
What is a feature flag?
A feature flag is a condition in your code that decides whether a feature is visible or active. In plain words: the new checkout is in the product, but a switch controls who sees it. The switch can be changed from a settings screen or configuration file without building and deploying again.
It turns a risky one-time launch into a controlled, reversible process.
What is the difference between deploying and releasing?
- Deploy: the new code is installed on production servers.
- Release: users can actually use the new behaviour.
Without flags, those two events are the same moment, so every deployment carries launch risk and launches wait for deployments. With flags, the code can go out quietly and often, in small pieces, while the business decides when to turn it on. That supports the small, frequent changes described in our guide to CI/CD and DevOps basics.
What are the benefits of feature flags?
- Decouple deployment from launch: marketing and operations pick the launch moment, not the build schedule.
- Gradual rollouts: expose a new feature to a small group, watch, then widen.
- Quick rollback: turning a flag off is faster and less stressful than redeploying an older version.
- A/B tests: show two versions and compare results. Our guide to A/B testing for small websites explains how to run tests that mean something.
- Beta programmes: give early access to chosen customers who agree to give feedback.
- Kill switches: disable a risky or failing function, such as a connection to a struggling third-party service, without taking the whole product offline.
What types of feature flag are there?
Different flags have different lives, and treating them alike causes trouble.
Release flags
Hide unfinished or newly built features until they are ready. These are short-lived: once the feature is fully launched, the flag should be deleted.
Experiment flags
Split users into groups to compare versions. They live as long as the experiment and must be removed once a winner is chosen.
Operational flags
Control how the system behaves under stress, such as switching off a heavy feature when servers are overloaded or when a dependency fails. These can be long-lived, and they deserve clear documentation and practice.
Permission flags
Control which customers or plans can use a feature, for example a premium module.
How do canary, staged and dark launches work?
- Canary release: send a small slice of real traffic or users to the new version first. If measures stay healthy, expand.
- Staged rollout: widen in steps, perhaps internal staff, then a friendly group, then a portion of everyone, then all users, with a pause to look at results after each step.
- Dark launch: run the new code path in production without showing its result to users, to see how it behaves under real data and load before anyone depends on it.
How do targeting rules work?
Targeting rules decide who sees the flag on. In words, common rules are:
- By user: specific named people, such as your own team or a beta tester.
- By account or company: everyone in a particular customer organisation, handy for business software where one customer asks for early access.
- By percentage: a share of users, chosen consistently so the same person always gets the same experience rather than flickering between versions.
- By attribute: location, plan, device or language.
Keep rules readable, and decide what happens when the flag service cannot be reached; the safe default is usually the old behaviour.
What are the risks of feature flags?
Flag debt
Every flag adds a branch to the code. Old flags that nobody removes make the product harder to understand and test. Treat leftover flags as a form of technical debt; our article on technical debt for non-technical founders shows why that matters.
Untested combinations
With many flags on or off in many combinations, nobody can test every path. Keep the number of active flags small, avoid flags that depend on each other, and test the main on and off states. Our guide to software testing and QA covers how to plan this.
Security of flag changes
A flag control panel can switch features, including security-related ones, in production. Restrict who can change flags, require sign-in with multi-factor authentication, keep an audit trail of who changed what and when, and be careful that flag data sent to a browser does not reveal unreleased plans or sensitive rules. Never rely on a front-end flag to protect something that must be restricted; enforce permissions on the server.
How should you name flags and assign ownership?
A flag nobody owns is never removed. A simple convention helps:
- Use clear names that describe the feature, not a code word, for example new-checkout-flow.
- Include or record the type and the team.
- Name an owner who is responsible for the flag.
- Record why it exists and an expected removal date.
How do you remove flags after launch?
Make removal part of the definition of done. Once a release flag has been at full rollout and stable for an agreed period, create a clean-up task: delete the flag check, delete the old code path and update tests. Review the list of flags regularly and challenge any that have outlived their purpose.
Should you build or buy flag tooling?
- Simple home-built: a configuration value or a database table works for a handful of release flags and a small team. It is cheap, but you must build the interface, access control, audit trail and percentage rollouts yourself.
- Dedicated service or open-source tool: offers targeting, gradual rollouts, audit trails and analytics out of the box, with an ongoing cost and a dependency on a third party.
Choose by the number of flags, the complexity of your targeting and how many people change flags. The logic is the same as in our build vs buy decision framework.
What should you observe during a rollout?
A rollout without monitoring is a guess. Before turning a flag on, decide what you will watch:
- Error rates and crashes for the flagged group compared with everyone else.
- Response times and server load.
- Business measures such as sign-ups, completed orders or support contacts.
Tag logs and metrics with the flag state so you can compare groups. Our guide to monitoring and observability basics shows how to set that up simply.
How do database changes stay backward compatible?
Rollback is only safe if the old code still works with the current database. Use an expand-and-contract approach:
- Expand: add new columns or tables without removing or renaming anything the old code uses.
- Deploy code that can work with both old and new structures, controlled by a flag.
- Migrate data gradually and verify it.
- Switch reads and writes to the new structure with the flag.
- Contract: only after the new path is stable and the flag is gone, remove the old columns.
Never combine a destructive database change with a feature launch in one step, because you will lose your safety net.
What does a good rollback plan look like?
- Define the signals that trigger a rollback so it is not a debate during an incident.
- Rehearse it, and tell support what to say to users.
A short worked example
Imagine a small team replacing the search on their customer portal. They deploy it behind a release flag, switched off, and first only staff see it. Then they turn it on for a small share of customers and compare errors and clicks with the old version. A slowdown appears with large accounts, so they switch the flag off in seconds, fix a query and try again. Once it is stable, they roll out to everyone, then delete the flag and the old code.
FAQ
What is a feature flag in software?
A feature flag is a switch in the code that turns a feature on or off without redeploying. It lets teams release features to selected users, test changes safely and switch something off quickly if it causes problems.
What is the difference between a feature flag and a kill switch?
A kill switch is a type of operational flag designed to turn off a feature or integration quickly during an emergency. Other feature flags control release, experiments or access, and are usually used in planned, gradual ways rather than in an emergency.
How many feature flags is too many?
There is no fixed number, but when nobody can explain what each flag does or test the combinations, you have too many. Keep release flags short-lived, give each an owner and a removal date, and review the list regularly.
Do small teams need a feature flag service?
Not always. A small team with a few short-lived release flags can use simple configuration. A dedicated tool becomes worthwhile when you need percentage rollouts, account targeting, audit trails or non-developers changing flags.
Related reading
- DevOps Basics: CI/CD for Small Teams Without the Jargon
- Software Testing and QA for Business Applications
- A/B Testing for Small Websites: Tests That Mean Something
Next steps
Pick one upcoming feature and put it behind a simple release flag. Decide in advance who sees it first, what you will monitor and what would trigger a rollback, and add a removal task to the plan. If you would like help setting up safer releases or a delivery pipeline, contact us and we can review your process together.



