Log-Rank Test Calculator

Compare two survival distributions from time-to-event and censoring data with a log-rank chi-square statistic and p value.

Log-rank survival comparison
Enter each subject as time and status, using 1 for an event and 0 for censoring.

About the log-rank test

The log-rank test compares the complete survival experience of two independent groups. It is designed for time-to-event outcomes such as time until death, relapse, equipment failure, recovery, or another defined endpoint. Unlike a comparison of average observed times, it correctly incorporates right-censored subjects whose event was not observed before follow-up ended. Each entry therefore contains a follow-up time and a status indicator: 1 means the event occurred and 0 means the observation was censored. At every distinct event time, the calculation identifies how many subjects in each group remain at risk immediately before that time. It counts the observed events and allocates an expected number to each group according to its share of the risk set. These observed-minus-expected differences are accumulated across all event times. A variance term accounts for the changing risk sets and tied events. The squared overall difference divided by its variance forms a chi-square statistic with one degree of freedom. The p value describes how surprising a difference at least this large would be if the two groups shared the same survival function. A small p value provides evidence that their survival distributions differ. It does not measure the size of the difference, prove treatment causality, or indicate that one group is better at every time. Kaplan-Meier curves, survival estimates at meaningful times, confidence intervals, and an effect estimate such as a hazard ratio add essential context. Censored observations contribute to every risk set before and including their recorded follow-up time but are not counted as events. The standard calculation assumes censoring is non-informative: conditional on the available information, censored subjects should have had survival prospects comparable to subjects who remained under observation. It also assumes independent subjects and clearly defined, consistently measured endpoints. The log-rank test is most sensitive when group hazards are approximately proportional over time. If Kaplan-Meier curves cross or treatment effects emerge only early or late, a single log-rank statistic may obscure the pattern. Weighted log-rank methods or time-varying survival models may be more informative in those settings. Always inspect survival curves and the number at risk over time. Enter one genuine subject per time-status pair and keep time units consistent across groups. Multiple events at the same time are handled together. This calculator implements the usual observed-versus-expected method and chi-square approximation, making it useful for checking examples, planning an analysis, and obtaining a quick reproducible comparison. Formal clinical or regulated analyses should follow a prespecified statistical plan and use validated software.

Log-rank test examples

Survival dataResultInterpretation
Events at 1,2,3 versus 4,5,6Chi-square = 5.051661Earlier events in group 1 produce a significant difference.
Identical event and censoring timesChi-square = 0, p = 1Matching survival patterns create no observed-minus-expected difference.
3 1, 5 0, 8 1 versus 4 1, 6 1, 9 0Censoring includedStatus zero removes a subject from later risk sets without counting an event.

How to use the log-rank calculator

  1. Enter each group 1 subject as a follow-up time followed by event status 1 or censoring status 0.
  2. Enter group 2 data in the same time units and format.
  3. Click Calculate Log-Rank Test to construct the event-time risk sets.
  4. Interpret the chi-square statistic and p value alongside the survival curves.

Log-rank test FAQ

What does censored mean?

A censored subject did not have the event observed during available follow-up. The subject still contributes information to risk sets up to the recorded censoring time.

What is the null hypothesis?

The null hypothesis is that the groups share the same survival distribution. Under it, observed event counts should fluctuate around the counts expected from each risk set.

Does the test estimate a hazard ratio?

No. The log-rank test provides a significance test, while a Cox proportional hazards model is commonly used to estimate a hazard ratio and confidence interval.

Can the test handle tied event times?

Yes. Events occurring at the same time are pooled in one risk-set calculation with the appropriate variance contribution.

What if the survival curves cross?

The ordinary log-rank test can lose power or conceal time-varying effects when curves cross. Inspect the curves and consider methods designed for nonproportional hazards.