DevTools Logo

Feature Flag Rule Builder

Feature Flag Rule Builder

Design targeting rules and percentage rollouts, simulate user bucketing, and export provider JSON.

Runs in your browser
Try an example

Flag design

2 variations · 1 rules
Variations (weights must total 100)
First targeting rule
20%

Simulator & exports

5 sample users · neutral
Sample user bucketing results
UserCountryBucketRuleVariation
user-1NO460control
user-2US83—control
user-3SE460control
user-4DK240control
user-5GB56—control

Examples

Nordic 20% rollout

Input
country in [NO, SE, DK] → 20% treatment
Output
Matched users bucket 0–19 get treatment; 20–99 get control

The clause gates who is eligible; the deterministic bucket decides the split within that group.

A/B/C weights

Input
A 50 · B 25 · C 25
Output
Buckets [0,50) → A, [50,75) → B, [75,100) → C

Contiguous normalised ranges guarantee every bucket maps to exactly one variation.

Unleash strategy

Input
rollout: 20, stickiness: userId, groupId: new-checkout
Output
gradualRolloutUserId strategy plus constraints

The same model compiles to each provider's vocabulary without changing the design.

About this tool

The Feature Flag Rule Builder designs targeting rules offline: variations and weights, ordered attribute clauses, a percentage rollout with a salt and assignment attribute, and per-environment fallback overrides. A simulator evaluates sample users so you can see the exact bucket and served variation before wiring up an SDK.

Bucketing uses murmur3 x86 32-bit over salt + '.' + attribute value, reduced mod 100. The same user gets the same bucket on every run, and changing the salt (or the key, when the salt is empty) reshuffles assignments deliberately. First matching rule wins; a rollout hit serves the treatment and a miss serves the rule's fallback variation.

One source of truth compiles to three shapes: provider-neutral JSON for an in-house evaluator, LaunchDarkly-style flag JSON with weights in 1000ths, and Unleash strategies with groupId and stickiness. Nothing calls a provider API and no SDK keys are requested.

What this tool does not do

  • Simulated users are sample fixtures — paste-style bulk simulation is capped at 10k users.
  • Exports are design artifacts; the tool does not push flags to any provider or validate against a live SDK.
  • Multivariate weights validate to exactly 100; normalisation applies only to bucket mapping, not to the emitted weights.

How to use this tool

  1. Define variations

    Give each variation a name, value and weight; weights must total 100 before exports are enabled.

  2. Add a targeting rule

    Pick an attribute, operator and values (for example country is one of NO, SE, DK), then set the rollout percentage.

  3. Simulate users

    Read the sample-user table: each row shows country, bucket, matched rule and served variation, updated live on every change.

  4. Export

    Switch between neutral, LaunchDarkly and Unleash output, then copy or download the JSON. Import neutral JSON to continue editing.

Use cases

Rollout policy design

Prototype a staged rollout and check deterministic assignments before implementing an SDK integration.

Provider migration

Export neutral JSON from one design and compare LaunchDarkly and Unleash representations side by side.

In-house flag service

Use the neutral export plus documented bucketing algorithm as an evaluator specification.

Clause operators

OperatorPredicate
is one ofAttribute value is in the values list
is not one ofAttribute value is absent from the list
starts with / ends withPrefix or suffix match against values
gt / ltNumeric comparison (non-numeric values compare false)
existsAttribute is present, non-null and non-empty

Bucketing: murmur3x86_32(salt + '.' + attributeValue) mod 100; LD weights are multiplied by 10.

Common mistakes

Mistake:Changing the flag key after launch with an empty salt.

Fix:An empty salt defaults to the key, so renaming the flag reshuffles every bucket. Set an explicit, permanent salt before rollout.

Mistake:Expecting provider APIs to match exactly.

Fix:The exports are provider-shaped design fragments with the exact bucketing key format documented; verify semantics against your SDK version before production use.

Mistake:Assuming later rules run after an earlier 100% rule.

Fix:First match wins. A catch-all 100% rule makes everything below it unreachable; the validator flags this.

Frequently asked questions

How is a user assigned to the rollout percentage?

The tool hashes salt + '.' + the assignment attribute value (for example userId) with murmur3 x86 32-bit, takes the hash mod 100, and compares the resulting bucket against the rollout percentage. The same input always produces the same bucket, so a user who sees the treatment once keeps seeing it. Changing the salt intentionally reshuffles assignments.

Is bucketing consistent across providers?

The algorithm is deterministic and follows the same shape as common SDK bucketing (hash mod 100), but exact compatibility depends on each provider's key prefix and seed. The neutral export documents the precise key format used here, and the LaunchDarkly and Unleash outputs are provider-shaped design fragments. Verify against your SDK version before relying on identical assignments across providers.

What is a clause versus a rule?

A clause is a single predicate over a user attribute: attribute, operator and values, such as country is one of NO, SE, DK. A rule is an ordered list of clauses plus a serve decision — either a fixed variation or a percentage rollout. All clauses in a rule must match, and the first matching rule wins; if none match, the fallback variation is served.

Can I import an existing flag?

You can round-trip the provider-neutral JSON this tool exports: paste it into the import field and the form restores variations, rules, salt and environment overrides. LaunchDarkly or Unleash JSON imports are intentionally not supported because their shape does not carry the same model — the difference is stated in the interface.

Does the tool call any provider API?

No. Everything — hashing, simulation and export — happens in your browser tab. No SDK keys or credentials are requested, and sample users are local fixtures. Exports contain flag configuration only, so they are safe to hand to a teammate or check into a repository.

References & standards