Feature Toggle
A feature toggle (also called a feature flag) is a conditional switch in code that turns a feature on or off at runtime without requiring a new deployment.
Definition
A feature toggle (also called a feature flag) is a conditional switch in code that turns a feature on or off at runtime without requiring a new deployment.
Overview
Feature toggles decouple deploying code from releasing a feature to users. Instead of merging a branch and having that change go live to everyone the moment it ships, developers wrap the new code path in a conditional check against a flag, deploy it disabled, and turn it on later — instantly, and without another deployment — once it's ready, whether that means a specific moment, a specific set of users, or a gradual rollout percentage. Martin Fowler and Pete Hodgson's widely cited categorization splits toggles into several types with different lifespans and purposes: release toggles hide incomplete work behind a flag so trunk-based development can continue without long-lived feature branches; experiment toggles power A/B tests by routing different users to different code paths; ops toggles act as an operational kill switch to disable a risky feature under load or during an incident; and permission toggles gate functionality by user tier, such as enabling a feature only for beta or enterprise customers. Simple toggles can be a hardcoded boolean or an environment variable, but most production systems use a feature-flag management service (LaunchDarkly, Unleash, Flagsmith, or a provider's own flagging service) that supports targeting rules, percentage rollouts, and remote real-time updates without a redeploy. The main risk of feature toggles is accumulated complexity: every toggle left in the codebase after it has served its purpose adds a conditional branch and a combinatorial testing burden, so toggle hygiene — removing flags once a feature is fully rolled out or fully reverted — is considered as important as the toggling mechanism itself.
Key Concepts
- Runtime on/off control over a code path without redeploying
- Support for percentage-based or targeted rollouts to specific user segments
- Distinct toggle categories: release, experiment, ops, and permission toggles
- Enables trunk-based development by hiding unfinished work behind a disabled flag
- Acts as an operational kill switch to quickly disable a problematic feature
- Often backed by a dedicated feature-flag management service with an SDK and dashboard
- Requires toggle-lifecycle hygiene to avoid accumulating stale conditional branches
Use Cases
Frequently Asked Questions
From the Blog
Feature Engineering: Turning Data Into Signal
Feature engineering turns raw columns into inputs a model can actually learn from. Learn the core techniques that often matter more than the algorithm itself.
Read More Data ScienceWhat Is Feature Engineering in Machine Learning?
Feature engineering is transforming raw data into inputs that help models learn. Good features often matter more than the algorithm. Learn the core techniques here.
Read More Data ScienceWhat Is Feature Scaling in Machine Learning
Feature scaling puts numeric inputs on a comparable range so no single feature dominates a model. Learn normalization, standardization, and when each matters.
Read More Data ScienceA Practical Feature Engineering Playbook for Tabular Data
Feature engineering for tabular data is best organised by data type and model family, with a validation loop that proves each feature earns its place. Learn how to treat numeric, categorical, temporal and event data differently, avoid leakage, and decide which transformations gradient-boosted trees genuinely need versus which only linear models do.
Read More