T-Statistic Calculator

Perform one‑sample or two‑sample independent t‑tests (Welch’s). Obtain t‑value, degrees of freedom, one/two‑tailed p‑value, Cohen’s d, and Hedges' g. Paste raw data or use summary statistics. Interactive t‑distribution curve with tooltip.

? One‑Sample t‑test ? Two‑Sample t‑test (Welch’s)
Tail type:
Input mode:
? One‑Sample: IQ example (μ₀=100, x̄=105, sd=15, n=30)
⭐ One‑Sample: exam score (μ₀=70, x̄=75, sd=8, n=25)
? Two‑Sample: A/B test (means 102.5 vs 97.8)
? Two‑Sample: large effect (110 vs 100, sd=12, n=40)
? Raw data example (one-sample: 5 numbers)
Privacy first: All calculations run locally in your browser. No data is uploaded.

Understanding the t‑Statistic & Hypothesis Testing

The t‑statistic measures how many standard errors the sample mean (or difference of means) lies from the hypothesized population parameter. It is the backbone of Student’s t‑test, used when the population standard deviation is unknown and sample sizes are moderate. William Sealy Gosset (aka “Student”) developed the t‑distribution in 1908 to monitor quality in Guinness breweries – a breakthrough in small‑sample inference.

One‑sample: t = (x̄ − μ₀) / (s / √n)   |   Two‑sample (Welch): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)

Welch–Satterthwaite df: df ≈ (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]

Why Use an Interactive T‑Statistic Calculator?

  • Instant Hypothesis Testing: Obtain exact p‑values without statistical tables. Ideal for A/B testing, clinical trials, and academic research.
  • Visual Learning: The t‑distribution curve adjusts to your degrees of freedom – see where your t‑statistic falls relative to critical regions.
  • Effect Size & Interpretation: Cohen’s d quantifies the magnitude of difference, moving beyond mere significance. For two-sample tests, Hedges' g provides a bias-corrected estimate for small samples.
  • Trusted & Transparent: Built on jStat library (accurate t‑CDF and inverse CDF), with full transparency in formulas.

Step‑by‑Step Calculation & Statistical Foundation

For a one‑sample t‑test, the null hypothesis assumes the population mean equals μ₀. The test statistic follows a t‑distribution with n−1 degrees of freedom if assumptions (normality, independence) are reasonably met. Our calculator computes the p‑value based on your selected tail (one‑tailed left/right or two‑tailed) using the cumulative distribution function of the t‑distribution. For two independent samples, we implement Welch’s t‑test, which does not assume equal variances and provides robust results even when variances differ.

The 95% confidence interval for the mean difference (or single mean) is also reported, giving a range of plausible values for the true parameter. Cohen’s d is computed as (mean difference) / pooled SD (one‑sample: d = (x̄ − μ₀)/s ; two‑sample: d = (x̄₁−x̄₂) / √[(s₁²+s₂²)/2] – a common approximation of the population standard deviation). Hedges' g is calculated as Cohen's d multiplied by a correction factor: g = d × (1 - 3/(4*(n₁+n₂)-9)) for two-sample tests, which reduces small-sample bias.

Practical Applications & Case Study

Case Study: E‑commerce Conversion Rate Optimization

A marketing team launched a new checkout UI. With 42 days of data (new design: n=42, mean conversion = 3.2%, sd=0.8%; old design: n=40, mean=2.9%, sd=0.9%). Using the two‑sample t‑test (Welch’s), the t‑statistic was 1.86 with df=78.3, p‑value = 0.066. At α=0.05, not statistically significant, but the effect size d=0.35 (small to medium). The team decided to collect more data. This calculator reproduces such real‑world scenarios, empowering data‑driven decisions.

? Data note: This case study is based on a simulated dataset reflecting patterns commonly observed in online retail experiments. No proprietary or confidential data was used.

Assumptions & Limitations

  • Independence: Observations must be independent within and between groups. In practice, this usually means the data were collected via simple random sampling from the population of interest, and that measurements do not influence each other.
  • Normality: The t‑test is robust to moderate departures from normality, especially with larger sample sizes (n ≥ 30). For small samples, consider visual checks (e.g., Q‑Q plots).
  • Welch’s robustness: Performs well even with unequal variances and sample sizes.

About this tool
This calculator is developed and maintained by the GetZenQuery Tech team. It relies exclusively on the open‑source jStat library for statistical computations. All formulas are explicitly shown and can be verified against standard statistical textbooks (e.g., Moore, McCabe & Craig, “Introduction to the Practice of Statistics”). We do not claim any academic or professional credentials beyond the implementation of well‑established mathematical methods. For critical decisions, please consult a qualified statistician or use certified software.

Last code audit: April 2026. References: Welch (1947), BMJ Statistics Notes, NIST/SEMATECH e-Handbook of Statistical Methods.

Frequently Asked Questions

The p‑value is the probability of observing a t‑statistic as extreme as the one computed, assuming the null hypothesis is true. A small p‑value (typically < 0.05) suggests evidence against the null.

Welch’s test does not assume equal variances and is recommended as the default for two‑sample comparisons. Our calculator exclusively uses Welch’s for two‑sample tests, ensuring more reliable results when variances differ.

This version focuses on independent one‑sample and two‑sample tests. For paired data, you can compute differences and run a one‑sample t‑test on the differences.

The PDF is calculated using jStat’s studentt.pdf, which is highly precise. The curve is redrawn at each calculation using the current degrees of freedom.

Accuracy is ensured by three measures:

  1. Library reliability: jStat is a widely used JavaScript statistics library; its t‑distribution functions have been validated against R and Python.
  2. Transparent formulas: All equations are displayed on this page and match standard textbooks. You can manually verify a few cases using a calculator or software like R.
  3. Local execution: Since everything runs in your browser, there is no server‑side rounding or data manipulation. You can inspect the source code (press F12) to confirm the logic.

If you suspect an error, please contact us with your inputs and expected results – we will investigate.

Important limitation
This tool is provided for educational and exploratory purposes only. It is not a substitute for professional statistical software (e.g., SAS, SPSS, R) in contexts where regulatory compliance, patient safety, or high‑stakes decisions are involved. Always verify critical results with a qualified statistician.