Kaplan–Meier calculator and curve generator
A free Kaplan–Meier calculator that draws a publication-style plot in seconds. Paste your data below and you get survival curves with censor ticks, a numbers-at-risk table, the median per arm, the log-rank p-value, the Cox hazard ratio with 95% CI, and RMST. Download as SVG or PNG. Everything runs in your browser, so the data never leaves your computer.
Paste one row per patient as arm,time,event (event: 1 = event, 0 = censored). You can paste from Excel or a CSV, or load the example.
Data format
One row per patient, three columns: the group name, the follow-up time, and whether the event happened (1) or the patient was censored (0). Time can be in any unit, as long as it is the same unit throughout. A header row is optional.
arm,time,event Control,2.3,1 Control,18.0,0 Drug,6.4,1 Drug,24.0,0
What the generator computes
- Kaplan–Meier estimate S(t) = ∏ (1 − di/ni) over event times, drawn as a step function with censored patients marked as ticks.
- Median survival: the first time the curve falls below 50%, or "not reached" if it never does. The median survival calculator adds 95% confidence intervals.
- Numbers at risk at each axis tick: patients still being followed and event-free.
- Log-rank p and hazard ratio (second group vs the first), the same as R's
survdiffandcoxph(Efron ties, R's default; Stata and SAS default to Breslow). For observed and expected events, use the log-rank test calculator. - RMST (restricted mean survival time) up to τ; see the RMST calculator for confidence intervals.
Only have a published figure?
If you have the curve but not the data, reconstruct the patient-level data from the figure, then paste the downloaded CSV here to re-plot, restyle or combine it.
Kaplan–Meier curves in other software
- R:
survfit(Surv(time, event) ~ arm)withsurvminer::ggsurvplot(fit, risk.table = TRUE). - Python:
lifelines.KaplanMeierFitterandadd_at_risk_counts. - Stata: the
risktableoption ofsts graph(Stata manual). - SAS: the
ATRISKoption of the survival plot inPROC LIFETEST(SAS documentation). - GraphPad Prism: a survival table, which creates the KM graph automatically.
- Excel: no built-in KM function. Sort by time, compute (1 − d/n) at each event time, take the cumulative product, and plot a step chart. The generator above is quicker.
FAQ
How do I create a Kaplan-Meier curve online for free?
Paste one row per patient (group, time, event) into the generator on this page and click Draw. It produces the curve, numbers at risk, medians, log-rank p, hazard ratio and RMST, and lets you download SVG or PNG.
Is my data uploaded anywhere?
No. The Kaplan–Meier generator runs entirely in your browser.
Can I make a Kaplan-Meier curve in Excel?
Not directly. You can compute the product-limit estimate by hand in a spreadsheet and plot a step chart, but a dedicated tool (or R/Python/Prism) is faster and less error-prone.
Have a KM figure from a paper? Get its data in a minute.
Upload a figure