Home / Tools

Log-rank test calculator

Updated 2026-09-25 · TrialCurve

The log-rank test compares two survival curves. Paste one row per patient below to get the chi-square statistic, the p-value, observed and expected events per group, and the hazard ratio. It runs in your browser; nothing is uploaded.

Paste one row per patient as arm,time,event (event 1 = event, 0 = censored), or load the example.

What the log-rank test does

At every time an event occurs, it compares the number of events in each group with the number expected if both groups had the same survival, given how many patients were still at risk. It adds up observed minus expected (O − E) over all event times and divides the square by its variance: χ² = (O − E)² / V, with 1 degree of freedom for two groups.

How to read the result

When the log-rank test misleads

It is most powerful when hazards are proportional. When curves cross or separate late (common with immunotherapy), it can miss real differences. Look at the curves, and consider the RMST difference or a weighted log-rank test.

Only have a published figure?

You need patient-level data for a log-rank test. Reconstruct it from the Kaplan–Meier figure, then paste the CSV here.

FAQ

What is the difference between the log-rank test and a Cox model?

The log-rank test gives a p-value for any difference between curves; the Cox model estimates the hazard ratio. The log-rank test is equivalent to the score test of a Cox model with one binary covariate.

Can I run a log-rank test from a published Kaplan-Meier curve?

Yes, after reconstructing individual patient data from the figure (the Guyot method). TrialCurve does this from an image in about a minute; paste the resulting CSV into this calculator.

How many groups can I compare?

This calculator compares each group with the first one pasted, two at a time.

Reconstruct IPD from your own figure. Upload a Kaplan–Meier plot and get curves, numbers at risk, pseudo-IPD, hazard ratios and a validation pack. Three figures a month are free.

Try the live demo Browse trial data API docs