π SIR Epidemic Model Simulator
How R0 shapes an outbreak's curve.
Peak simultaneous infections
For informational purposes only, not medical advice.
The SIR model splits a population into Susceptible, Infected, and Recovered, and simulates the outbreak day by day. With 10,000 people, 10 initially infected, and R0 of 2.5, the model peaks at 2495 simultaneous infections before burning through susceptibles. Move R0 and watch the peak collapse or explode: the model's entire lesson is how nonlinear transmission is.
Kermack and McKendrick published the SIR equations in 1927, and they still underpin epidemic thinking a century later. Every flatten-the-curve graphic from 2020 was this model wearing different clothes.
How to Use This Simulator
Set the population, the initial infected count, R0, and the simulation length. The tool runs the daily simulation and reports the peak and totals.
Enter the population and how many are infected on day zero.
Set R0: the average new infections each case causes in a fully susceptible population.
Read the peak infections, the day it hits, and the total ever infected. Then lower R0 and compare.
The Model
Each day, susceptible people meet infected people and some convert; infected people recover at a fixed rate (here, a 5-day infectious period). R0 sets the transmission rate: above 1 the outbreak grows, below 1 it dies. The peak arrives when so many have recovered that each case replaces itself with fewer than one new case, the herd-immunity threshold, 1 - 1/R0, made visible.
Flattening the curve is R0 reduction in action: lower R0 does not just shrink the peak, it delays it and reduces the total, because slower spread strands the virus among the already-immune. The area under the curve is the argument for every intervention.
Worked Example
Population 10,000, 10 infected, R0 2.5, 120 days: the simulation peaks at 2495 simultaneous infections, with the great majority of the population eventually infected. Drop R0 to 1.2 with the same start and the peak collapses to a few hundred, the outbreak crawling instead of exploding.
That comparison is the model's gift: small R0 changes produce enormous outcome changes. Masks, ventilation, and vaccines do not need to stop transmission to matter; shaving R0 from 2.5 toward 1 transforms the curve.
Reading Your Result
| R0 | What happens |
|---|---|
| Below 1 | Outbreak fizzles. Each case replaces itself with less than one. |
| 1 to 2 | Slow burn. Manageable peaks, long duration. |
| 2 to 4 | Fast epidemic. Sharp peak, most infected eventually. |
| Above 4 | Explosive. Measles-like spread through susceptibles. |
My take: run the model twice, once at the disease's natural R0 and once 30 percent lower, and the difference will recalibrate your intuition about interventions more than any article. Nonlinearity has to be seen to be believed.
Limits
The classic SIR assumes homogeneous mixing, no behavior change, no waning immunity, no variants, and no interventions, none of which held in any real pandemic. It teaches mechanism, not forecasting. Real epidemic models layer age structure, mobility, and behavior on top of these bones.
Related Tools
Connect to prevention with the vaccine efficacy calculator and layered protection in our Swiss cheese model guide.
For informational purposes only, not medical advice. Consult a healthcare professional.
Frequently Asked Questions
What is the SIR model?
A classic epidemic model dividing the population into Susceptible, Infected, and Recovered compartments, simulated over time. Published by Kermack and McKendrick in 1927, it remains the foundation of infectious disease modeling.
What is R0?
The basic reproduction number: average new infections caused by one case in a fully susceptible population. Above 1, outbreaks grow; below 1, they die out. It combines the pathogen's biology with contact patterns.
What does flatten the curve mean?
Reducing R0 through interventions so infections spread over more time with a lower peak, keeping demand within healthcare capacity and reducing total infections. The SIR model visualizes it directly.
What is the herd immunity threshold?
The immune fraction at which spread stalls: 1 - 1/R0. For R0 2.5 it is 60%; for measles at R0 15, about 93%. Immunity comes from infection, vaccination, or both.
Why do small R0 changes matter so much?
Because transmission compounds exponentially. Cutting R0 from 2.5 to 1.75 does not cut the peak by 30%; it transforms the outbreak's shape, peak, and total. Nonlinearity is the model's core lesson.
What are the model's assumptions?
Everyone mixes evenly, no behavior change, permanent immunity, constant R0, and no births, deaths, or migration. Real epidemics violate all of these, which is why SIR teaches concepts rather than forecasting.
How is R0 different from Rt?
R0 is the baseline in a fully susceptible population; Rt (effective R) is the current value given immunity and interventions. Policy tracks Rt; biology sets R0.
Can SIR model COVID or flu?
For teaching the dynamics, yes. For forecasting, only with major extensions: variants, waning immunity, age structure, seasonality, and behavior. Treat this simulator as a classroom, not a crystal ball.
What is the generation interval?
The average time between one infection and the infections it causes, related to the infectious period (5 days in this simulator). Shorter intervals make outbreaks explode faster at the same R0.
Who uses epidemic models?
Public health agencies, academic modelers, and policymakers planning interventions and capacity. This page offers the classic toy model behind their far more elaborate tools.