Math calculator

Attributable Risk Calculator

How much of the disease the exposure accounts for.

Risk in the exposed, and overall

Relative risk 9, and 88.8889% of the disease in the exposed group is attributable to the exposure. But only 1% of the population is exposed, so the population attributable fraction is 7.4074%.

RR = 9.0000, 1.00% exposed

AF 88.8889% in the exposed, PAF 7.4074% overall

Risk is 45.0000% among the exposed and 5.0000% among the unexposed, a difference of 40.0000 percentage points. The two fractions differ by 81.48 points because only 1.00% of this population is exposed — the exposed-group figure says nothing about population burden.

Risk difference

40.0000 pp

exposed minus unexposed

Attributable fraction

88.889%

share of the EXPOSED group's risk

Population AF

7.407%

share of the WHOLE population's risk

Number needed to harm

2.50

1 / risk difference

The cohort table with risks and totals
With diseaseWithoutTotalRisk
Exposed9112045.0000%
Unexposed99188119805.0000%
Whole population108189220005.4000%

This relative risk at every exposure prevalence

RR held at 9.0000. Only how many people are exposed changes.

Population attributable fraction at seven exposure prevalences for a fixed relative risk
ExposedPopulation attributable fractionReading
1%7.4074%a real risk to individuals, a small share of the total
5%28.5714%a substantial share of the population burden
10%44.4444%a substantial share of the population burden
25%66.6667%removing the exposure would remove most of the disease
50%80.0000%removing the exposure would remove most of the disease
75%85.7143%removing the exposure would remove most of the disease
90%87.8049%removing the exposure would remove most of the disease

The attributable fraction among the exposed does not appear in this table because it does not move: it depends only on the relative risk. Every number that changes here is driven by prevalence alone.

AF depends only on RR; PAF also needs prevalence PAFs across risk factors can sum above 100% Both assume the association is causal

What this tool shows

A risk factor with a relative risk of 9 in 1% of the population accounts for 88.8889% of the disease among the exposed and only 7.4074% of the disease in the population. A factor with a relative risk of 1.2 in 80% of the population accounts for 16.6667% among the exposed and 13.7931% overall — nearly twice the population burden, from a fifth of the relative risk. The two fractions rank risk factors in opposite orders, and public-health decisions run on the second one.

  • Risk difference — the absolute extra risk exposure carries
  • Attributable fraction among the exposed, which depends only on the relative risk
  • Population attributable fraction, which also needs the exposure prevalence
  • Number needed to harm, and its protective counterpart
  • The same relative risk swept across seven exposure prevalences
  • Protective exposures handled with their signs rather than silently flipped
AF and PAF Risk difference Prevalence sweep Number needed to harm

Every attributable fraction assumes the association is causal.

Updated 12 September 2026 · Works in any browser, no installation

Attributable risk is the extra risk that exposure carries in absolute terms, and the attributable fraction expresses it as a share of the exposed group’s total risk. The population attributable fraction asks a different question — what share of ALL the disease would disappear if the exposure did — and it depends on how common the exposure is as well as how dangerous. Relative risk answers neither: it is a ratio, and a ratio cannot tell you how many people are affected.

At a glance

Formula shown
AR = risk in the exposed − risk in the unexposed. AF = AR ÷ risk in the exposed = (RR−1)/RR, which is why it depends only on the relative risk. PAF = (population risk − unexposed risk) ÷ population risk = p(RR−1) / (1 + p(RR−1)), where p is the proportion exposed — and that p is the entire reason the two fractions disagree. Number needed to harm = 1/AR.
Scenario support
Cohort studies and public-health prioritisation, occupational exposure assessment, deciding which risk factor a prevention programme should target, environmental and dietary epidemiology, and any setting where a relative risk needs translating into how many people are actually affected.
Educational estimate
Planning support from the values you enter — not professional advice.

The two fractions can rank risk factors in opposite orders

This is not a subtlety. It is the difference between what a risk factor does to a person and what it does to a population, and the two answers routinely disagree about which factor matters most.

Factor A: relative risk 9, in 1% of the population. Among the exposed, 88.8889% of the disease is attributable to it — almost all of it. In the population, 7.4074%.

Factor B: relative risk 1.2, in 80% of the population. Among the exposed, 16.6667%. In the population, 13.7931%.

Factor A is five times more dangerous to an individual and factor B causes nearly twice as much disease. Both statements are true of the same two numbers, and a programme that can only address one of them should usually address B.

The mechanism is entirely prevalence. AF = (RR−1)/RR contains no prevalence term at all, so it is fixed once the relative risk is. PAF multiplies by how many people are actually exposed, and 80% beats 1% by enough to overturn a ninefold difference in risk.

A relative risk cannot tell you how many people are affected

The risk difference is the number a person can act on, and it is the one most often missing from the reporting.

“Doubles your risk” describes a ratio and nothing else. From 1 in a million to 2 in a million, and from 20% to 40%, are both a doubling. One is a rounding error and one changes a life.

The risk difference distinguishes them immediately — 0.0001 percentage points against 20 — which is why absolute risks belong in any report meant for a decision.

Number needed to harm is the same quantity inverted, and often the most readable form: 1 divided by the risk difference is how many people must be exposed for one extra case to occur.

For a beneficial exposure the same arithmetic gives a number needed to treat, and the tool relabels it rather than reporting a negative harm.

Every attributable fraction assumes causation

The word “attributable” is doing something the arithmetic cannot support on its own. It is worth being explicit about what is being assumed.

“X% of cases are attributable to the exposure” means removing the exposure would remove that share. That is a counterfactual claim, and the 2×2 table contains no information about counterfactuals.

Confounding produces the same table as causation. If the exposed differ from the unexposed in some other way that causes the disease, the attributable fraction will be large and removing the exposure will change nothing.

Reverse causation produces it too. Early disease that causes the exposure looks exactly like exposure that causes disease, in these four numbers.

Which is why adjusted PAFs exist — computed from a model that controls for measured confounders rather than from a raw table. This tool computes the crude version, which is the right starting point and the wrong place to stop.

Population attributable fractions do not sum to 100%

It is natural to add them up and expect a total, and the total routinely exceeds 100% without anything being wrong.

Diseases have multiple sufficient causes. A case caused by both smoking and asbestos is preventable by removing either, so it counts in both fractions.

Published PAFs for a single disease commonly total 150% or more, and that is a statement about overlapping causal pathways rather than an arithmetic error.

Sequential or partitioned PAFs exist for when a total is genuinely needed, and they depend on the order in which the factors are removed — which is a modelling choice, not a property of the data.

So a PAF is best read one factor at a time. “Removing this would remove 14% of cases” is meaningful; summing several such statements is not.

A case-control study cannot produce a PAF from its own counts

The population attributable fraction needs the exposure prevalence in the population. A case-control sample fixes how many cases and controls to recruit, which destroys exactly that information.

The risk in the exposed and the risk in the unexposed are not estimable from a case-control table, because the sampling fraction differs between cases and controls. Only the odds ratio survives.

A PAF can still be computed, but only with the prevalence supplied from outside — a census, a survey, or the control group when controls genuinely represent the source population.

Levin’s formula does exactly that, substituting the odds ratio for the relative risk and taking prevalence from an external source. It is standard, and it inherits the reliability of whichever prevalence estimate went into it.

This tool computes the cohort version, which requires that the exposed and unexposed groups were sampled in proportion to the population — true for a cohort study and false for a case-control one.

Reporting attributable risk

Four things, and the second is what makes the fraction interpretable.

Give the absolute risks in both groups, not only the ratio. They are two numbers and they are what makes the risk difference checkable.

Say which fraction you are quoting. “88% attributable” and “7% attributable” can describe the same exposure, and the labels AF and PAF are the only thing separating them.

Give the exposure prevalence you used for the PAF. It is the input the PAF is most sensitive to, and it often comes from a different source than the risk estimate.

And state whether the estimate is crude or adjusted. A crude PAF from a raw table and a PAF adjusted for confounders are different quantities, and the gap between them is usually the most informative thing in the analysis.

Sources and methodology

References for attributable and population attributable fractions.

Method. Risks are computed within each exposure group and the fractions from those risks directly, so the identity AF = (RR−1)/RR is a checkable consequence rather than the definition used. The prevalence sweep holds the computed relative risk fixed and varies only the exposure proportion, which is what makes the central comparison exact: RR 9 at 1% exposure gives a PAF of 7.4074% while RR 1.2 at 80% gives 13.7931%, from tables the tool ships as presets. Protective exposures return negative risk differences and negative fractions rather than being silently flipped, since a negative attributable fraction is the correct signal that the preventable fraction is the measure wanted. An empty exposed or unexposed group returns no result. That engine is verified on every change against 115 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Relative RiskRisk ratio and odds ratio from one table with the divergence between them plotted: they agree to half a percent at a 1% baseline, and at an 80% baseline the odds ratio is exactly half the risk ratio.
Number Needed to TreatNNT from the absolute risk reduction, with the relative figure beside it — two trials reporting the identical “50% reduction” have NNTs of 7 and 1,000, and the common shortcut says 2 for both.
Odds RatioOdds ratio, relative risk, risk difference and number needed to treat from one 2x2 table — because an odds ratio of 6.00 can describe a relative risk of 1.50.
Incidence RateEvents per person-time with the exact Poisson interval, including at zero events: the exact two-sided upper limit is 3.688879 per unit of person-time, not the 3 the one-sided rule of three gives.
Standardized Mortality RatioSMR with the expected count built stratum by stratum, and the small-count disagreement shown: 5 observed against 2.07 expected gives p = 0.0417 and an exact interval of 0.7843 to 5.6369.
Phi CoefficientPhi for a 2x2 table printed against the ceiling its marginals impose: on [10, 40, 0, 50] every case is exposed, a complete association, and phi is 0.3333333, which is exactly max phi.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool, not medical or public-health advice. Attributable fractions are counterfactual claims — they state what would happen if the exposure were removed — and a 2×2 table cannot distinguish causation from confounding or reverse causation, so a crude fraction is a starting point rather than a finding.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (5 updates)

Published 12 September 2026

  1. Published a tool that separates what a risk factor does to a person from what it does to a population, because the two answers routinely disagree about which factor matters most.
  2. Demonstrated the reversal with two shipped cohorts: relative risk 9 in 1% of the population gives an attributable fraction of 88.8889% among the exposed and a population attributable fraction of 7.4074%, while relative risk 1.2 in 80% gives 16.6667% and 13.7931%. The weaker, commoner factor causes nearly twice as much population disease.
  3. Added a sweep that holds the relative risk fixed and varies only exposure prevalence, which shows directly that the attributable fraction contains no prevalence term while the population fraction is driven by almost nothing else.
  4. Verified AF = (RR-1)/RR and Levin's PAF formula as consequences of the risk arithmetic rather than as the definitions used, across 300 generated tables each, agreeing to 1e-12.
  5. Reported protective exposures with their signs rather than flipping them silently: RR = 0.25 gives an attributable fraction of -300%, which is the arithmetic saying the preventable fraction is the measure wanted.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.