What is a feature flag?

By Weapp · Updated

A feature flag is a switch in the code that turns a feature on or off without needing to release a new version. It's used for gradual rollout, for testing with selected customers, and as a panic button if something goes wrong. The flag separates deployment from launch, but unused flags become technical debt if never cleaned up.

Feature flags are one of the tricks that separate a mature development team from one that releases new features with crossed fingers. The term sounds technical, but the idea is everyday: a switch. Here’s what a feature flag is, what it’s used for, and why it’s worth knowing about even as a buyer.

The definition

A feature flag – sometimes called a feature toggle – is a switch built into the code that turns a feature on or off without needing to release a new version. The feature is already in place in the software, but the flag decides whether it’s visible and active or not.

That sounds simple, and it is. But the effect is big: it breaks the link between the code existing and the feature being on. Instead of a new feature inevitably going live the same second it’s released, the team can decide exactly when, for whom, and how fast it should roll out – and switch it off just as easily.

The three main uses

Feature flags are mainly used for three things, and all three reduce risk.

  1. Gradual rollout. Instead of turning on a new feature for everyone at once, it’s released to a small share of users first. If everything looks good, it’s widened step by step. If problems show up, only a fraction has been affected, and the feature can be switched off before it reaches more people.
  2. Testing with selected customers. A feature can be turned on just for a pilot group – a few selected customers or the company’s own staff – who get to try it live and give feedback before it opens up to everyone. You test in reality, but at a controlled scale.
  3. Panic button for bugs. If a recently released feature turns out to misbehave, it can be switched off instantly with a click. You avoid rushing out an emergency fix and shipping new code under pressure – the feature is simply turned off until the bug is investigated calmly.

A concrete scenario

Say a payment service is adding a new payment method. The code is deployed, but behind a switched-off feature flag – no user sees anything yet. The team turns it on first for their own staff, who test the whole flow live. Everything works.

Then it’s turned on for five percent of customers. The numbers look good, and the share is increased step by step to everyone. Had something gone wrong along the way, the flag would have been switched off in a second, without panic and without a new release. Same feature, but rolled out with control at every step instead of one big, irreversible leap.

The difference between deploying and launching

That scenario shows perhaps the most important point: feature flags separate deployment from launch.

Deploying is putting the new code into the live environment. Launching is making the feature available to users. Without flags, it’s the same event – code out, feature live, at the same moment, often late at night to minimize the damage if something goes wrong. With flags, the code can be deployed switched off at any time, and the feature turned on later at a chosen moment. That makes every change calmer and less risky, which is a big part of the value.

The maintenance warning: clean up old flags

There’s a downside worth knowing about. Every feature flag is a branch in the code – an “if the flag is on, do this, otherwise that.” As long as the flag is needed, that’s fine. But once a feature is fully rolled out to everyone, the flag has served its purpose, and if it’s left in place it clutters up the code.

Many forgotten flags make the code harder to read and easier to get wrong in – a form of technical debt that builds up quietly. A responsible team therefore cleans up flags that have played their part, so only the active ones remain. It’s nothing to worry about, but it’s one of the things that separates disciplined development from sloppy. If you’d like a neutral opinion on how your system is managed on points like this, get in touch.

Frequently asked questions

What is a feature flag, explained simply?

It's a switch built into the software that controls whether a given feature is on or off. Instead of a new feature going live for everyone the instant it's released, a flag lets you turn it on for whoever you want, whenever you want – without touching the code again. The feature is already there; the flag just decides whether it's lit up.

What are feature flags used for?

Mainly three things. Gradual rollout: a new feature is turned on for a small percentage of users first and widened if things look good. Testing with selected customers: a feature is lit up only for a pilot group. And as a panic button: if something goes wrong, the feature can be switched off instantly, without rushing out an emergency fix. It's all done with a simple toggle instead of a new release.

What's the difference between deployment and launch?

Deployment is putting new code into the live environment. Launch is making the feature available to users. Without feature flags, they happen at the same time. With flags, you can deploy the code switched off and turn it on later – at a set time, or after testing, for example. It removes the stress of code and visible feature having to happen at exactly the same moment.

Can feature flags cause problems?

Yes, if they're not managed. Every flag is a branch in the code, and a flag left in place long after the feature has fully rolled out makes the code harder to read and more fragile. Many forgotten flags become a form of technical debt. The fix is simple but takes discipline: clean up flags that have served their purpose, so only the ones actually needed remain.

Is a feature flag something I need to care about as a buyer?

Not the details, but it's good to know about. A team using feature flags is usually a good sign – it means they can release cautiously and quickly switch off something misbehaving, which lowers the risk of every change. What you can ask about is how new features are rolled out and how fast a broken feature can be turned off if needed.