Log-Rank Test Calculator
A free online log-rank test calculator (Mantel-Cox test) for comparing Kaplan-Meier survival curves between two or more groups. Get the chi-square statistic, p-value, hazard ratio, median-survival differences, and APA-format reporting in seconds — built for medical research, clinical trials, reliability engineering, and ecological time-to-event studies.
Step 1 — Enter Your Survival Data
For each group, enter survival times (comma-separated) and corresponding event status (1 = event/death, 0 = censored). The group name is editable — click on it to rename.
Accepted: .csv · .txt · .xlsx · .xls — Click columns to assign each as a separate cluster (group)
📋 Expected file format (click to expand)
Each column in your file becomes one cluster (group) of survival times.
Click the column buttons in the picker to assign which columns to load. Use a + suffix on a value
(e.g., 52+) to mark a censored observation, or supply a paired event column.
Example CSV:
Treatment,Control 52,48 55+,61 47,55 ...
Enter rows directly. Each row is one observation: time + event (1 or 0) + group name.
Technical Notes & Formulas
Sub-section A — Formulas Used
1. Expected events per group at each event time tᵢ:
2. Log-Rank Chi-Square Statistic (Mantel-Haenszel form):
3. Two-Group Variance Form (Mantel-Cox):
4. Approximate Hazard Ratio:
5. P-Value (right-tail of χ² distribution):
Sub-section B — Technical Notes & Assumption Checks
- Censoring is non-informative (independent of event of interest).
- Hazards are proportional over time (constant hazard ratio).
- Survival probabilities are similar for early- and late-recruited subjects.
- Event times are correctly recorded; ties handled by Mantel-Haenszel weighting.
- If hazards cross → use Wilcoxon-Gehan test or Peto-Peto modified test.
- If you need to adjust for covariates → use Cox proportional hazards regression.
When to Use the Log-Rank Test
This free log-rank test calculator is designed for researchers, clinicians, epidemiologists, reliability engineers, and graduate students who need to compare time-to-event survival curves between two or more independent groups. The log-rank test is the most widely used non-parametric test in survival analysis and powers nearly every published Kaplan-Meier comparison.
Decision Checklist
- You have time-to-event data (e.g., days until death, months to relapse, hours to failure).
- Some observations are right-censored (event not yet observed at study end).
- You want to compare 2 or more independent groups.
- The proportional-hazards assumption is plausible (curves do not cross).
- Do NOT use if observations are paired or matched → use stratified log-rank.
- Do NOT use if you need to adjust for covariates → use Cox regression.
- Do NOT use if hazard curves clearly cross → use Wilcoxon-Gehan or Peto-Peto.
Real-World Examples
- Medical Research — Cancer drug trial comparing overall survival between a new chemotherapy (Treatment) and the standard of care (Control) over 60 months.
- Cardiology — Time to first major adverse cardiac event in patients receiving coronary stents from manufacturer A vs manufacturer B.
- Reliability Engineering — Time-to-failure of industrial pumps from two suppliers, testing whether one brand has longer service life.
- Customer Analytics — Subscription churn time across pricing plans (Basic, Pro, Enterprise) — when do customers cancel?
- Wildlife Ecology — Telemetry survival analysis comparing radio-collared individuals in a protected reserve vs an adjacent buffer zone.
Sample Size Guidance
Power for the log-rank test depends on the number of events, not just sample size. A common rule: aim for at least 30 events per group to detect a hazard ratio of about 1.5 with 80% power at α = 0.05. Schoenfeld's formula gives the exact event count required.
Related Tests — Decision Tree
How to Use This Log-Rank Test Calculator
- Choose a sample dataset (or skip to your own data) — five domain-diverse datasets are pre-loaded.
- Pick your input mode — Type/Paste (default), Upload CSV/Excel, or Manual Entry.
- Enter survival times for each group as comma-separated values (default), e.g.,
52, 48, 55, 61, 47. - Enter event status as 0/1 — 1 means the event was observed, 0 means censored.
- Rename groups by clicking the bold group name at the top of each block.
- Add or remove groups using the +/× buttons (supports 2 to 6 groups).
- Set significance level (α) — 0.05 is the default for 95% confidence.
- Click "Run Log-Rank Test" — chi-square, p-value, hazard ratio, and Kaplan-Meier curves are computed instantly.
- Read the interpretation in the auto-generated plain-language summary and the five publication-style writing examples.
- Export your report as a Doc (plain text) or PDF (publication-ready, branded).
Worked Example — Drug Trial
Dataset: 10 cancer patients per arm. Group "Treatment" times: 52, 55, 47, 60, 68, 70, 73, 75, 80, 85
with events 1, 1, 0, 1, 1, 1, 0, 1, 0, 1. Group "Control" times:
48, 61, 55, 58, 50, 45, 42, 38, 35, 30 with events all 1.
Run the calculator — the chi-square statistic, p-value, hazard ratio, and APA report appear in seconds.
Frequently Asked Questions
What is the log-rank test and when should I use it?
The log-rank test (also called the Mantel-Cox test) is a non-parametric hypothesis test that compares the survival distributions of two or more independent groups. Use it when you have time-to-event data with right-censoring — for example, survival in a clinical trial, time to machine failure, or time to customer churn — and want to test whether the underlying survival curves are the same across groups.
What is a p-value in the log-rank test, and how do I interpret it?
The p-value is the probability of observing a chi-square statistic at least as large as the one calculated, assuming the null hypothesis is true (i.e., all survival curves are identical). A p-value below the chosen alpha (typically 0.05) leads us to reject the null hypothesis. For example, a p-value of 0.03 means there is a 3% probability of seeing this much separation between curves if all groups truly had the same survival.
What does statistical significance mean in survival analysis — and does it equal practical importance?
Statistical significance (p < alpha) tells you the survival difference is unlikely due to chance, but it does not tell you whether the difference is clinically or practically important. With very large samples, tiny survival differences can become statistically significant. Always pair the p-value with the hazard ratio and the difference in median survival time to gauge real-world magnitude.
What is the hazard ratio, and how do I interpret it?
The hazard ratio (HR) compares the instantaneous event rate between two groups. HR = 1 means equal hazards; HR < 1 means the reference group has lower risk; HR > 1 means higher risk. As a rough benchmark: HR around 1.3 is small, 1.5 to 2.0 is medium, and above 2.0 is large. The log-rank test gives an approximate HR via the observed-over-expected ratio.
What assumptions does the log-rank test require?
Key assumptions: (1) censoring is independent of the event (non-informative); (2) survival probabilities are similar for early- and late-recruited subjects; (3) event times are accurately recorded; and most importantly, (4) proportional hazards — the hazard ratio between groups is constant over time. If the survival curves cross, the proportional-hazards assumption is violated and the Wilcoxon-Gehan or Peto-Peto test should be used instead.
How large a sample do I need for the log-rank test?
Power in the log-rank test depends on the number of events, not the number of participants. A practical rule is at least 30 events per group to detect a hazard ratio of 1.5 at alpha = 0.05 with 80% power. Schoenfeld's formula calculates the exact number of events required: d ≈ (z_alpha/2 + z_beta)² / (p1 × p2 × (log HR)²).
What is the difference between the log-rank test and Cox regression?
The log-rank test is a hypothesis test that returns a single p-value — it asks "do these curves differ?". Cox proportional hazards regression goes further: it models the hazard rate as a function of one or more predictors and returns a hazard ratio with confidence interval per predictor. Use the log-rank test for a simple group comparison; use Cox regression when you need to adjust for confounders.
How do I report log-rank test results in APA 7th edition format?
A typical APA report reads: "A log-rank test was conducted to compare survival between treatment and control groups. The treatment group showed significantly longer survival, χ²(1) = 8.42, p = .004. The estimated hazard ratio was 0.42, indicating a 58% lower event risk in the treatment group." The Detailed Interpretation section above provides five complete reporting templates (APA, thesis, plain-language, abstract, and pre-registration).
Can I use this calculator for my published research or clinical trial?
This tool is designed for educational use, teaching, and exploratory analysis. For peer-reviewed clinical research, replicate your results in validated software such as R (survival package), SAS PROC LIFETEST, Stata stcox, or Python lifelines. Cite the tool as: STATS UNLOCK. (2025). Log-rank test calculator. https://statsunlock.com/log-rank-test-calculator
What if my log-rank test result is non-significant?
A non-significant result (p > alpha) does not prove the survival curves are identical — it only means the data do not provide sufficient evidence to reject the null hypothesis. Check whether your study had enough events to detect the effect (Type II error). Consider the Wilcoxon-Gehan test if early-time differences matter most, a stratified log-rank test if hazards are non-proportional, or a Bayesian survival analysis to quantify evidence in favor of equality.
References
The following references support the statistical methods used in this log-rank test calculator, covering survival analysis, hazard ratio interpretation, and best practices in clinical trial reporting and Kaplan-Meier curve comparisons.
- Mantel, N. (1966). Evaluation of survival data and two new rank order statistics arising in its consideration. Cancer Chemotherapy Reports, 50(3), 163–170. PubMed
- Peto, R., & Peto, J. (1972). Asymptotically efficient rank invariant test procedures. Journal of the Royal Statistical Society: Series A, 135(2), 185–207. https://doi.org/10.2307/2344317
- Kaplan, E. L., & Meier, P. (1958). Nonparametric estimation from incomplete observations. Journal of the American Statistical Association, 53(282), 457–481. https://doi.org/10.1080/01621459.1958.10501452
- Cox, D. R. (1972). Regression models and life-tables. Journal of the Royal Statistical Society: Series B, 34(2), 187–220. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
- Schoenfeld, D. A. (1983). Sample-size formula for the proportional-hazards regression model. Biometrics, 39(2), 499–503. https://doi.org/10.2307/2531021
- Bland, J. M., & Altman, D. G. (2004). The logrank test. BMJ, 328(7447), 1073. https://doi.org/10.1136/bmj.328.7447.1073
- Klein, J. P., & Moeschberger, M. L. (2003). Survival analysis: Techniques for censored and truncated data (2nd ed.). Springer. https://doi.org/10.1007/b97377
- Collett, D. (2015). Modelling survival data in medical research (3rd ed.). CRC Press. https://doi.org/10.1201/b18041
- Therneau, T. M., & Grambsch, P. M. (2000). Modeling survival data: Extending the Cox model. Springer. https://doi.org/10.1007/978-1-4757-3294-8
- Bewick, V., Cheek, L., & Ball, J. (2004). Statistics review 12: Survival analysis. Critical Care, 8(5), 389–394. https://doi.org/10.1186/cc2955
- Bradburn, M. J., Clark, T. G., Love, S. B., & Altman, D. G. (2003). Survival analysis Part II: Multivariate data analysis — an introduction to concepts and methods. British Journal of Cancer, 89(3), 431–436. https://doi.org/10.1038/sj.bjc.6601119
- Therneau, T. M. (2024). A package for survival analysis in R (version 3.5-8). CRAN. https://CRAN.R-project.org/package=survival
- Davidson-Pilon, C. (2019). lifelines: Survival analysis in Python. Journal of Open Source Software, 4(40), 1317. https://doi.org/10.21105/joss.01317
- American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). APA. https://doi.org/10.1037/0000165-000
- NIST/SEMATECH. (2013). e-Handbook of statistical methods — Survival analysis. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/apr/apr.htm









