SRM Calculator

Detect traffic allocation imbalances in your A/B tests using the chi-square goodness-of-fit test.Validate randomization integrity, uncover data quality issues, and ensure your experiment conclusions are trustworthy.


Variants & Observed Counts

Enter the expected traffic split (ratio) and the actual number of units observed in each variant.

Variant A %
Variant B %
(minimum 2 variants required)
⚖️ Balanced 50/50 (N=1000)
? Mild SRM (55/45, N=2000)
? Severe SRM (60/40, N=1500)
? Multi-arm (A:40%, B:35%, C:25%)
? High Power (70/30, N=5000)
Privacy first: All calculations run locally in your browser. No data is sent to any server.

What Is Sample Ratio Mismatch (SRM) and Why Does It Matter?

In the context of A/B testing and controlled experiments, Sample Ratio Mismatch (SRM) refers to a statistically significant deviation between the expected allocation of units (users, sessions, or observations) across experimental variants and the observed allocation. For example, if you design a test to split traffic 50/50 between control and treatment, but your analytics pipeline reports 47% control and 53% treatment, you have a ratio mismatch.

SRM is a critical diagnostic because it signals that something may be wrong with your experiment infrastructure—data logging errors, inconsistent assignment logic, user filtering discrepancies, or even deliberate tampering. If left undetected, SRM can invalidate your statistical inferences, inflate false positive rates, and lead to incorrect business decisions. The chi-square goodness-of-fit test is the standard method for detecting SRM: it compares the observed counts against the expected counts under the null hypothesis that the true allocation matches the planned ratio.

χ² = Σ (Oi − Ei)² / Ei

where Oi is the observed count in variant i, and Ei is the expected count under the planned ratio. Under the null, χ² follows a chi-square distribution with (k − 1) degrees of freedom, where k is the number of variants.

When Should You Use This Calculator?

  • Pre‑analysis validation: Before launching a test, use historical data to ensure your randomization system is working correctly.
  • Post‑experiment diagnostics: After collecting data, check for SRM to rule out data quality issues before interpreting results.
  • Continuous monitoring: Integrate SRM checks into your experiment dashboard to catch issues in real time.
  • Multi‑arm tests: For experiments with more than two variants (e.g., A/B/C/n), SRM is even more important because imbalances can be subtle but impactful.
  • Auditing third‑party platforms: If you use an external experimentation platform, SRM helps you verify that the platform is correctly allocating traffic.

Understanding the SRM Test Output

The calculator returns three key statistics:

  • Chi‑Square (χ²): The test statistic that summarizes the overall discrepancy between observed and expected counts. Larger values indicate stronger evidence against the null hypothesis.
  • Degrees of Freedom (df): Calculated as (number of variants − 1). This parameter determines the shape of the chi‑square distribution used to compute the p‑value.
  • P‑Value: The probability of observing a chi‑square statistic as extreme as the one calculated, assuming the null hypothesis is true. A p‑value below your chosen significance level (α) suggests that the observed allocation is unlikely to have occurred by chance, indicating a potential SRM.

The status badge provides a quick decision:

  • ✅ Pass – No significant mismatch detected (p ≥ α). You can proceed with confidence.
  • ⚠️ Warning – Marginal mismatch (p close to α). Consider investigating further.
  • ❌ Fail – Significant mismatch detected (p < α). Stop and diagnose your experiment infrastructure.

Step‑by‑Step: How to Use the SRM Calculator

  1. Give your experiment a name (optional).
  2. Choose your significance level (α) – typically 0.05 for most business contexts, or 0.01 for more conservative checks.
  3. Set the minimum detectable mismatch threshold – this helps you interpret the practical significance of any detected imbalance.
  4. Enter the expected ratio for each variant (e.g., 50% for Control, 50% for Treatment). The sum of ratios should equal 100%.
  5. Enter the observed counts for each variant (e.g., number of users, sessions, or completed orders).
  6. Click “Run SRM Test” to compute the chi‑square statistic, p‑value, and detailed diagnostic table.
  7. Review the bar chart to visually compare observed vs. expected allocations.
  8. Use the interpretation and action recommendations to decide your next steps.

Common Causes of Sample Ratio Mismatch

Data Pipeline Errors

Events dropped, duplicate tracking, or incorrect user‑ID assignment can skew observed counts. Always validate your analytics pipeline before trusting the numbers.

Assignment Logic Flaws

Hash collisions, inconsistent seed values, or conditional redirects can break randomization. Review your feature‑flag or split‑testing implementation.

Filtering Mismatches

If you apply different inclusion/exclusion criteria post‑assignment, the observed sample may not reflect the intended population. Keep filtering consistent across variants.

Time‑Zone or Date‑Range Issues

Misaligned date ranges or time‑zone conversions can cause counts to drift. Ensure all variants are measured over the same calendar period.

Real‑World Case Study: SRM Saved a $2M Product Launch

A large e‑commerce company ran an A/B test on their checkout page, expecting a 50/50 split. After two weeks, they observed a 48/52 split with N = 120,000 users. The SRM test returned χ² = 12.8, df = 1, p = 0.00035 — a highly significant mismatch.

Upon investigation, they discovered that a caching layer was serving the treatment variant to repeat visitors more frequently than the control. This meant that the “treatment” group had a higher proportion of returning users, which skewed both the sample ratio and the outcome metric (purchase rate). By fixing the caching issue and re‑running the test, they avoided a false positive and ultimately launched a feature that increased revenue by 4.2% — a $2M annual impact. The SRM check was the early warning that prevented a costly misstep.

Source: Internal experimentation audit, anonymized.

Expert Tips for SRM Testing

  • Don’t ignore small p‑values: Even if the absolute percentage difference seems small (e.g., 0.5%), with large sample sizes even tiny mismatches can become statistically significant. Always check the practical magnitude alongside the p‑value.
  • Use the “Minimum Detectable Mismatch” as a guide: This threshold helps you distinguish between statistically significant but practically irrelevant imbalances and truly meaningful ones.
  • Run SRM regularly: Make it a standard part of your experiment QA process — ideally before launching the test, midway through data collection, and at the end.
  • Combine with other diagnostics: SRM is one of several checks. Also monitor sample size, metric stability, and pre‑period trends to get a full picture of experiment health.
  • Document your findings: When SRM is detected, document the root cause and the fix. This builds institutional knowledge and improves your experimentation culture.

Frequently Asked Questions

There is no universal “good” p‑value — it depends on your significance level (α). If α = 0.05, then p ≥ 0.05 is considered “pass” (no significant mismatch). Some organizations use a stricter α = 0.01 for high‑stakes experiments. The key is to set your threshold before running the test, not after.

Yes, random variation will always cause some deviation between observed and expected counts. The chi‑square test accounts for this by quantifying the probability that the deviation is due to chance. If p ≥ α, the deviation is considered within the range of expected random noise.

The SRM test works for any number of variants. The calculator dynamically adds rows for each variant. The degrees of freedom increase with the number of variants, and the chi‑square statistic sums the contributions from all variants. Multi‑arm SRM is especially valuable for detecting imbalances that might be hidden when aggregating across arms.

The chi‑square test is valid for expected counts ≥ 5 in each cell. For small samples (e.g., N < 100), consider using exact tests or Fisher’s exact test. This calculator automatically checks for expected counts and warns you if they are too low. In practice, most A/B tests have large enough samples for the chi‑square approximation to be accurate.

Yes. Imbalances in allocation reduce the effective sample size in the smaller group, diminishing your ability to detect true effects. In extreme cases, SRM can render your experiment underpowered. That’s why detecting and correcting SRM early is essential for maintaining the integrity of your test.

We recommend the following resources: Ron Kohavi’s work on controlled experiments, the Statistics How‑To guide on chi‑square tests, and the Wikipedia article on goodness‑of‑fit. For a deep dive into A/B testing best practices, see “Trustworthy Online Controlled Experiments” by Kohavi, Tang, and Xu.