Vaccine efficacy calculator
With 20 infections among 1,000 vaccinated people and 80 among 1,000 on placebo, vaccine efficacy is 75%. Enter the four counts from a trial's results table to recompute the headline percentage yourself. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Vaccinated infections
- 20
- Vaccinated n
- 1,000
- Placebo infections
- 80
- Placebo n
- 1,000
- Vaccinated attack rate
- 0.02 percent
- Placebo attack rate
- 0.08
- Relative risk
- 0.25
- Efficacy percent
- 75
Vaccine efficacy is the percent reduction in infection risk among vaccinated people compared with a placebo or otherwise unvaccinated group observed in the same study window. Students, trial analysts, journalists, and product teams compute that percentage from four numbers: infections in the vaccinated arm, size of the vaccinated arm, infections in the placebo arm, and size of the placebo arm. This vaccine efficacy calculator applies the classical one-minus-relative-risk identity: divide the vaccinated attack rate by the placebo attack rate, subtract that relative risk from one, and multiply by one hundred.
What vaccine efficacy means and how the four counts become a percentage
The classical estimator used in textbooks, briefing documents, and introductory epidemiology courses is one minus the relative risk, expressed as a percentage. Relative risk is the vaccinated attack rate divided by the placebo attack rate. When the two attack rates are equal, efficacy is zero because the vaccine did not change risk in this crude table.
When the vaccinated arm has no infections and the placebo arm has some, efficacy is one hundred percent. When the vaccinated arm has a higher attack rate than placebo, the percentage is negative, which this calculator reports honestly rather than clipping to zero or hiding the sign. Use it when you already have closed-cohort counts and need a reproducible VE percent, not when you still need person-time, overlapping follow-up, or a protocol-specified primary analysis.
What to enter and what you get back
Any negative count fails because a trial cannot record minus three infections or a negative roster. A group size of zero fails because attack rate is infections divided by n, and division by zero is undefined. Infection counts that exceed their group size fail because an attack rate greater than one is not a valid closed-cohort proportion.
If the placebo arm recorded zero infections, the placebo attack rate is zero and relative risk is undefined, so the task fails instead of returning Infinity. Failed validation is not billed.
What you can do with it
Science journalism and trial explainers
Recompute a published trial's headline vaccine efficacy from the four counts in the results table and quote a deterministic percentage next to the source numbers.
FAQ
How is vaccine efficacy calculated from infection counts?
Efficacy percent is (1 − (ARV/ARU)) × 100, where ARV is vaccinated infections over vaccinated n and ARU is placebo infections over placebo n.
What happens if a group size is zero or a count is negative?
Negative counts are not valid trial data, and a group size of zero makes the attack rate undefined. Those failures are not billed.
Can vaccine efficacy be negative or over one hundred percent?
Negative efficacy is returned when the vaccinated attack rate exceeds the placebo attack rate. Values above one hundred percent do not occur for valid closed-cohort counts (infections cannot be negative, so ARV cannot be below zero).
What is the difference between vaccine efficacy and vaccine effectiveness?
This calculator reports trial-style vaccine efficacy from a vaccinated arm versus a placebo or unvaccinated comparator using four counts. Observational vaccine effectiveness from real-world person-time or test-negative designs is a different analysis and a different search intent.
Does the calculator give a confidence interval?
No. It applies only the four-count identity, one minus the relative risk. It does not fit Kaplan–Meier curves, Poisson models or confidence intervals, and it does not work with person-time.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/health/vaccine-efficacy \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"vaccinated_infections":20,"vaccinated_n":1000,"placebo_infections":80,"placebo_n":1000}'const res = await fetch("https://api.kit.forhosting.com/health/vaccine-efficacy", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"vaccinated_infections": 20,
"vaccinated_n": 1000,
"placebo_infections": 80,
"placebo_n": 1000
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/health/vaccine-efficacy",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"vaccinated_infections": 20,
"vaccinated_n": 1000,
"placebo_infections": 80,
"placebo_n": 1000
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/health/vaccine-efficacy", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"vaccinated_infections":20,"vaccinated_n":1000,"placebo_infections":80,"placebo_n":1000}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"vaccinated_infections":20,"vaccinated_n":1000,"placebo_infections":80,"placebo_n":1000}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/health/vaccine-efficacy", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"vaccinated_infections": 20,
"vaccinated_n": 1000,
"placebo_infections": 80,
"placebo_n": 1000
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "health.vaccine_efficacy",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The result is a stable efficacy_percent you can pin in tests, worksheets, and dashboards. Negative counts and zero group sizes fail with invalid_input and are never billed.
What vaccine efficacy means and how the four counts become a percentage
Vaccine efficacy, often abbreviated VE, is the percent reduction in the risk of a defined endpoint among people who received the vaccine compared with people who received placebo or otherwise remained unvaccinated. Attack rate in each arm is simply infections divided by the size of that arm: vaccinated_infections over vaccinated_n, and placebo_infections over placebo_n. Multiplying the complement of that ratio by one hundred yields efficacy_percent. This endpoint does not fit Kaplan–Meier curves, Poisson models, or confidence intervals; it is the four-count identity journalists and students actually type into a spreadsheet. Identical inputs always produce identical JSON because the path is pure arithmetic with no network, no model, no random seed, and no wall clock.
Input contract, response shape, and error behaviour
Send a JSON body with four required finite numbers. vaccinated_infections is the number of endpoint events in the vaccinated group. vaccinated_n is the number of people, or comparable roster units, in that group and must be greater than zero. placebo_infections is the number of endpoint events in the placebo or unvaccinated comparator. placebo_n is the comparator group size and must be greater than zero. Each field may arrive as a JSON number or as a numeric string; documented aliases such as vaccinated_cases, n_vaccinated, placebo_cases, and unvaccinated_n are accepted when the canonical name is omitted. Missing fields, empty strings, and non-finite values fail with invalid_input naming the field. On success the body echoes the four inputs, reports vaccinated_attack_rate and placebo_attack_rate as proportions, reports relative_risk as their ratio, and reports efficacy_percent as one hundred times one minus that ratio. unit is always percent. formula restates the identity so a user interface can show the teaching line next to the number. method is always one_minus_relative_risk so downstream code can branch without sniffing shapes.
Where a vaccine efficacy API earns its keep, pricing, and limits
Classrooms and tutoring platforms use a vaccine efficacy calculator so learners can check homework against a deterministic oracle instead of a silent spreadsheet typo on the relative-risk step. Failed validation does not consume balance. People making personal health decisions should follow professional medical advice and the trial's published statistical analysis, not a single automated percentage. Keep requests small, pin the rounded fields in tests, and you get reproducible vaccine efficacy for homework, newsroom graphics, and edge workers without standing up a biostatistics stack of your own. Science-communication desks recompute a published trial's headline VE from the four counts in the results table and quote efficacy_percent without re-deriving the identity under deadline. Product teams that already store arm sizes and event counts in a warehouse can post those four fields and persist efficacy_percent beside the raw counts for dashboards and export columns. This is a calculation and teaching tool, not a diagnostic medical device and not a substitute for a protocol-specified analysis with person-time, overlapping confidence intervals, or regulatory endpoints.
Integration use cases
Epidemiology homework and exam grading
Let students submit vaccinated and placebo infection counts with group sizes and verify efficacy_percent against the classical one-minus-relative-risk identity.
Health-education apps and SaaS backends
Call the same four-count contract from a free browser widget and from prepaid API grading so classroom demos and production pipelines never disagree.
Technical questions
What does the vaccine efficacy calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.