100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
DevOps

Feature Flag

BeginnerConcept1.2K learners

A feature flag (also called a feature toggle) is a configuration mechanism that lets teams turn a piece of functionality on or off at runtime, without deploying new code, decoupling code deployment from feature release.

Definition

A feature flag (also called a feature toggle) is a configuration mechanism that lets teams turn a piece of functionality on or off at runtime, without deploying new code, decoupling code deployment from feature release.

Overview

Feature flags wrap a piece of functionality in a conditional check against a remote or local configuration value, so that a feature can be shipped to production in a disabled state and then enabled later — for everyone, for a specific percentage of users, or for a targeted segment — without a new deployment. This separation of "deploy" from "release" lets teams merge and ship code continuously while still controlling exactly when and to whom a feature becomes visible. Flags are commonly used to implement gradual rollouts similar to canary deployment, to run A/B tests comparing feature variants, and as operational kill switches that can instantly disable a problematic feature without requiring a rollback or redeploy. Dedicated feature-flag services and platforms — including capabilities built into broader delivery platforms like Harness — provide targeting rules, audit logs, and real-time flag updates so changes propagate to running applications without a restart. Because flags accumulate over time, teams need discipline to remove stale flags once a feature is fully released or abandoned; otherwise the codebase accumulates conditional branches that add complexity and risk. Feature flags are often used alongside deployment strategies such as rolling deployment or blue-green deployment, giving teams two independent levers — infrastructure-level traffic routing and application-level flags — for controlling risk during a release.

Key Concepts

  • Runtime toggles that decouple code deployment from feature release
  • Percentage-based or segment-based rollout targeting
  • Kill-switch capability to instantly disable a problematic feature
  • Support for A/B testing and experimentation
  • Real-time flag updates without redeploying or restarting the application
  • Audit logging of who changed which flag and when

Use Cases

Gradually rolling out a new feature to an increasing percentage of users
Running A/B tests to compare feature variants
Acting as an operational kill switch to disable a broken feature instantly
Enabling early access to features for internal teams or beta users
Shipping incomplete code to production safely behind a disabled flag

Frequently Asked Questions

From the Blog