This was originally published on rollgate.io/blog/ab-testing-feature-flags .
Why A/B Test with Feature Flags?
Most teams think A/B testing requires a dedicated experimentation platform — Optimizely, LaunchDarkly Experimentation, or Google Optimize (RIP). These tools cost thousands per month, add SDK bloat, and introduce yet another vendor into your stack.
Here's the thing: if you already have feature flags, you already have 80% of what you need for A/B testing .
A feature flag with percentage-based rollout is fundamentally an A/B test. The only missing pieces are:
Consistent assignment — same user always sees the same variant
Variant tracking — recording which variant each user saw
Metric collection — measuring outcomes per variant
Statistical analysis — determining if the difference is real
Let's build this step by step.
The Basics: Flags as Experiments
A traditional feature flag splits users into two groups: flag ON vs flag OFF.…