Site icon Codanics

Kaplan–Meier Survival Curve Calculator (Log-Rank)

Kaplan–Meier Survival Calculator: free online tool by Codanics that runs in your browser
Epidemiology & clinical research

Kaplan–Meier Survival Calculator: Survival Curves, Median Survival, Log-Rank Test and Hazard Ratio

Paste follow-up times, an event indicator (1 = event, 0 = censored) and an optional group, and get publication-ready Kaplan–Meier curves with confidence bands, censor marks and a number-at-risk table. The tool also reports median survival with its confidence interval, survival at any time point, the log-rank test and hazard ratios from a Cox model. Results match R’s survival package.

✅ No login needed100% freeRuns in your browserYour data stays on your device
Kaplan–Meier Survival Calculator✅ Free · no login📚 Cite this tool
Your data never leaves your PC. Your data is analysed on your own computer or phone, even when you upload a CSV or Excel file. Nothing is uploaded, stored or seen by Codanics, and no login is needed.
  • PriceFree, no login or sign-up needed
  • Your dataProcessed in your browser, never uploaded
  • Works onPhone, tablet or computer, any modern browser
  • Made byDr. Muhammad Aammar Tufail, Codanics
  • Published17 November 2026
  • Last updated16 November 2026

📚 How to cite this tool

This tool is free. If it helped your thesis, paper, report or assignment, please cite it. It keeps the tools free and helps other students find them.

Citation · APA 7th edition

Tufail, M. A. (2026). Kaplan–Meier survival calculator: survival curves, median survival, log-rank test and hazard ratio [Online tool]. Codanics. Retrieved 16 November 2026, from https://codanics.com/tools/kaplan-meier-calculator/

In-text citation: (Tufail, 2026) · Narrative: Tufail (2026)

The access date is today’s date, filled in automatically. Author: Muhammad Aammar Tufail. Published 17 November 2026.

🚀 Follow Codanics channel on WhatsApp for more updatesNew free tools, scholarships, PhD positions and research tips, straight to your phone. Free lessons on YouTube too.

How to use the kaplan–meier survival calculator

  1. Prepare one row per subject: the follow-up time (from the start of the study to the event or the last contact), the status (1 = event happened, 0 = censored, meaning still event-free at the last contact or lost to follow-up) and, to compare groups, a group column.
  2. Paste the rows into the box, or use Paste from Excel or Upload CSV / Excel and pick the columns. The example is the classic acute myeloid leukaemia (AML) trial from R’s survival package.
  3. Choose the confidence interval type (log is R’s default, log-log is the SAS and Stata default) and, if you like, a time point such as 12 months for the survival estimate.
  4. Read the median survival with its CI, the log-rank test and the hazard ratios. Adjust the plot (CI bands, censor marks, median lines, number at risk, axis) and download it as PNG or SVG.
  5. Copy the results sentence and download the full survival table as CSV for your appendix.

How the Kaplan–Meier estimator works

Survival data have a special problem: some people have not had the event by the end of the study, or drop out early. Their times are censored: we only know they survived at least that long. Throwing them away, or treating them as events, would bias the result. The Kaplan–Meier (product-limit) method uses every person for as long as they were followed. At each time an event occurs, the probability of surviving that moment is (people at risk − events)/people at risk, and the survival curve is the running product of these probabilities.

S(t) = Π over event times tᵢ ≤ t of (1 − dᵢ / nᵢ) nᵢ = number at risk, dᵢ = events at tᵢ Greenwood: Var[log S(t)] = Σ dᵢ / (nᵢ (nᵢ − dᵢ)) log CI: S(t) × exp(± z × SE[log S]) (R default) log-log CI: S(t)^exp(± z × SE[log S] / log S(t)) (SAS / Stata default) plain CI: S(t) ± z × S(t) × SE[log S]

The median survival is the first time at which the curve falls to 0.5 or below. Its confidence interval is read from where the confidence limits cross 0.5, exactly as R’s print(survfit()) does. If the curve never reaches 0.5, the median is “not reached” (NR), which is common when most people survive.

Log-rank test and hazard ratio

The log-rank test compares the observed number of events in each group with the number expected if all groups had the same survival. It is the standard test for comparing survival curves and is most powerful when the hazards are proportional. The Peto–Peto version gives more weight to early differences.

Eₖ = Σ nₖᵢ × dᵢ / nᵢ χ² = (O − E)ᵀ V⁻¹ (O − E), df = groups − 1 Cox model: h(t | group) = h₀(t) × exp(β), HR = exp(β), CI = exp(β ± z × SE)

The hazard ratio comes from a Cox proportional hazards model with the first group as the reference. HR = 0.5 means that, at any moment, the comparison group has half the risk of the event. The Cox score test is the log-rank test (identical when there are no tied event times).

Checked against R. With the AML example, survival estimates, standard errors and all three CI types match survfit(Surv(time, status) ~ x, data = aml); medians and their CIs match print(survfit()); the tests match survdiff(); and the hazard ratio, SE and Wald, score and likelihood-ratio tests match coxph() (Efron ties).

How to report survival results

Give the number of subjects and events in each group, the median follow-up, the median survival with its CI, survival at a clinically meaningful time point (for example 1-year or 5-year survival), the log-rank p-value and the hazard ratio with its CI. Show the Kaplan–Meier plot with a number-at-risk table, as most journals now require. The curves become unreliable towards the right, where few people remain at risk.

References: Kaplan EL, Meier P (1958) J Am Stat Assoc 53:457–481 · Greenwood M (1926) Rep Public Health Med Subj 33 · Mantel N (1966) Cancer Chemother Rep 50:163–170 · Cox DR (1972) J R Stat Soc B 34:187–220 · Therneau TM, Grambsch PM (2000) Modeling Survival Data. Springer.

Learn the statistics behind these numbers. Codanics has free statistics, R and Python lessons on YouTube and full courses for researchers.

Frequently asked questions

What does censored mean in survival analysis?

A censored subject did not have the event while being observed, either because the study ended or because they were lost to follow-up. We know only that their survival time is at least as long as their follow-up. Code them as status 0.

How do I find the median survival time from a Kaplan–Meier curve?

Draw a horizontal line at 0.5 (50% survival) and read the time where it meets the curve. The calculator does this for you and gives the confidence interval. If the curve stays above 0.5, the median has not been reached.

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

The log-rank test only tells you whether survival curves differ. Cox regression estimates how much: the hazard ratio with a confidence interval, and it can adjust for other variables. For one grouping variable, the Cox score test equals the log-rank test.

Which confidence interval type should I use?

R uses the log transformation by default; SAS and Stata use log-log. Both keep the limits between 0 and 1 and perform better than the plain (linear) interval. Say which you used.

Can I compare more than two groups?

Yes. Add as many groups as you need (up to 8). The log-rank test then has groups − 1 degrees of freedom, and the Cox model gives a hazard ratio for each group against the first one.

How should my data be coded?

One row per subject: time as a number (days, weeks, months or years), status 1 for the event and 0 for censored, and an optional group label. Text such as dead/alive or yes/no, and R’s 2/1 coding, are recognised too.

Do I need to log in or create an account to use the kaplan–meier survival calculator?

No. There is no login, no sign-up and no email required. Open the page and start using it straight away, for free, on any device.

How do I cite this tool in my thesis or paper?

Use the citation box on this page. In APA 7th edition: Tufail, M. A. (2026). Kaplan–Meier survival calculator: survival curves, median survival, log-rank test and hazard ratio [Online tool]. Codanics. Retrieved [date you used it], from https://codanics.com/tools/kaplan-meier-calculator/. BibTeX, RIS (EndNote, Mendeley, Zotero), MLA, Harvard, Chicago and Vancouver formats are also available.

Free guides and courses from Codanics

More free tools

See all free Codanics tools → · Codanics on YouTube · WhatsApp channel

Made by Dr. Muhammad Aammar Tufail, Codanics. First published 17 November 2026, last updated 16 November 2026. Found a bug or have an idea for a new tool? Tell us on the WhatsApp channel or in the comments on YouTube. Results are for learning and planning; check important analyses with a statistician or your supervisor.
Exit mobile version