Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Hazard Ratio Calculator

Calculate hazard ratio and confidence interval for two groups. Useful for survival analysis when comparing event rates over time between cohorts.

Enter the Details

Use this hazard ratio calculator to easily calculate the relative hazard, confidence intervals
and p-values for the hazard ratio (HR) between an exposed/treatment and control group. One and
two-sided confidence intervals are reported, as well as Z-scores based on the log-rank test.

Raw data (Enter 5 columns of numbers separated by commas, spaces, or tabs
column 1: time,
column 2: events in treatment group,
column 3:: number at risk in treatment group,
column 4:: events in control group,
column 5: number at risk in control group):

  %


Result will appear here...


Last updated: April 14, 2026

Created by: Eon Tools Dev Team

Reviewed by: Ankit Khatiwada



What the hazard ratio calculator does

The hazard ratio compares how quickly an event happens over time in two groups. This calculator takes survival data across a series of time points, the events and the numbers still at risk in a treatment group and a control group, and works out the hazard ratio, along with a confidence interval and a p-value.

It is the standard measure in survival analysis, used when what matters is not just whether an event happens but when. Below is what a hazard is and how the ratio is found.

How to use it

  1. Enter your survival data as five columns per row: the time, then the events and the number at risk in the treatment group, then the events and the number at risk in the control group.
  2. Set a confidence level, then press Calculate for the hazard ratio and its statistics, or Reset to clear it.

What a hazard is

A hazard is the rate at which an event happens at a given moment, among those who have not yet had it. Think of it as the instantaneous risk: for a group still event-free at some time, the hazard is how fast the event is striking right then. Unlike a single overall risk, it can change as time passes, rising or falling over the course of a study.

This time dimension is what sets survival analysis apart. Two treatments might end up with the same total number of events, yet one delays them far longer, which matters enormously for something like survival after a diagnosis. The hazard captures that timing, and the hazard ratio compares it between groups.

How the hazard ratio is worked out

At each time point where events occur, the calculator compares how many events actually happened in each group against how many would be expected if the two groups shared the same underlying hazard. Adding these observed and expected counts across all the time points, the hazard ratio is the ratio of observed to expected events in one group against the other.

This is the logic of the log-rank method, the standard approach for comparing survival between groups. It weaves together the whole sequence of time points rather than looking at a single snapshot, which is what lets it account for when events happen, not just how many. From the same building blocks it also produces the p-value and confidence interval.

Reading the hazard ratio

The hazard ratio is read against 1, like the other ratio measures. A hazard ratio of exactly 1 means the event is happening at the same rate in both groups, so there is no difference in timing. Above 1 means the treatment group is having events faster than the control group, and below 1 means slower.

So a hazard ratio of 0.7 means that at any given moment, the treatment group is having the event at 70 percent of the control group's rate, a 30 percent lower hazard, which for a treatment is a good result. A hazard ratio of 1.5 would mean the event is striking half as fast again in the treatment group. The further from 1, the larger the difference in how quickly the event arrives.

The proportional hazards assumption

A single hazard ratio rests on an assumption worth knowing about: that the ratio between the two groups' hazards stays roughly constant over time. This is the proportional hazards assumption. It does not require the hazards themselves to be steady, only that their ratio holds, so if the treatment group's hazard is always about 70 percent of the control's, one number describes the whole study.

When that assumption breaks, a single hazard ratio can mislead. If a treatment helps early but not later, or the two survival curves cross, then no one ratio captures what is happening, and the average it reports papers over a changing story. So a hazard ratio is most trustworthy when the effect is reasonably steady over time, and worth a second look when there is reason to think it is not.

A worked example

Imagine a trial following a treatment group and a control group over time, recording at each point how many had the event and how many remained at risk. Feeding those rows in, the calculator might return a hazard ratio of, say, 0.7.

That would mean the treatment group experienced the event at about 70 percent of the rate of the control group throughout the study, a 30 percent reduction in the instantaneous risk. The accompanying confidence interval would show the range of hazard ratios consistent with the data, and if that interval sat entirely below 1, the benefit would be statistically significant.

Entering your data

Enter one row per time point, each with exactly five numbers: time, treatment events, treatment number at risk, control events, and control number at risk, separated by spaces or commas. Set a confidence level, and the calculator returns the hazard ratio, its confidence interval, and a p-value based on the log-rank method.

Questions people ask

What is a hazard ratio?

A comparison of how quickly an event happens over time in two groups, expressed as the ratio of their hazards, the instantaneous event rates. It is the key measure in survival analysis.

What is a hazard?

The rate at which an event occurs at a given moment among those who have not yet had it, an instantaneous risk that can change as time passes.

What does a hazard ratio of 0.7 mean?

That the treatment group has the event at 70 percent of the control group's rate at any moment, a 30 percent lower hazard. Above 1 means faster, below 1 means slower.

What is the proportional hazards assumption?

That the ratio between the two groups' hazards stays roughly constant over time. When it holds, one hazard ratio describes the study; when it breaks, a single number can mislead.

References

A quick note on where the methods here come from. Hazard functions and survival analysis are set out in the NIST/SEMATECH e-Handbook of Statistical Methods, the US government's public statistics reference, in its chapter on reliability and survival. OpenStax provides free, widely used statistics textbooks covering the underlying probability and hypothesis testing.

  1. NIST/SEMATECH e-Handbook of Statistical Methods (hazard functions and survival). https://www.itl.nist.gov/div898/handbook/
  2. OpenStax, Introductory Statistics (probability and hypothesis testing). https://openstax.org/details/books/introductory-statistics-2e


Ankit Khatiwada

Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.