The SIR model is a classic, deterministic compartment model for infectious disease dynamics. It divides a closed population into three groups:
S: susceptible (can become infected)
I: infectious (currently infected and able to transmit)
R: removed/recovered (no longer infectious; typically assumed immune)
Given initial conditions and two rate parameters—β (infection/transmission rate) and γ (recovery/removal rate)—the model produces an “epidemic curve”: infections rise, peak, and then fall as susceptibility is depleted. This calculator simulates that curve numerically over time using a discrete time step.
What the inputs mean
Total population (N): the total number of people in the modeled population. In a basic SIR model, N stays constant.
Initial infected (I₀): number of infectious people at time 0.
Initial recovered (R₀): number of removed/recovered people at time 0.
Initial susceptible (S₀): implied by the others: S₀ = N − I₀ − R₀. For the model to make sense you should have N ≥ I₀ + R₀.
Infection rate (β) (per day): controls how quickly susceptible people become infected through contact with infectious people. Larger β makes outbreaks grow faster and peak higher (all else equal).
Recovery rate (γ) (per day): controls how quickly infectious people leave the I compartment. The average infectious period is approximately 1/γ days.
Time step (Δt) (days): the simulation increment. Smaller values generally improve numerical stability/accuracy.
Steps: number of iterations. Total simulated duration is approximately Steps × Δt days.
Model equations (continuous time)
The standard SIR differential equations (Kermack–McKendrick) are:
These equations assume that transmission is proportional to the product S·I (homogeneous mixing) and scaled by 1/N.
Key derived quantities
Basic reproduction number: R₀ = β/γ. If R₀ > 1 and most people are susceptible, infections can initially grow; if R₀ < 1, infections tend to die out.
Effective reproduction number: Re(t) = (β/γ) · (S(t)/N). Even with R₀ > 1, Re(t) declines as S decreases; the epidemic starts shrinking once Re(t) drops below 1.
Average infectious duration: about 1/γ days.
Discrete-time simulation (Euler method)
This calculator advances the model using a forward Euler discretization with time step Δt:
Sn+1 = Sn − Δt · β · Sn In / N
In+1 = In + Δt · β · Sn In / N − Δt · γ · In
Rn+1 = Rn + Δt · γ · In
In general, smaller Δt reduces numerical error. If Δt is too large, Euler updates can overshoot and produce unrealistic values (e.g., negative S or I), especially when β is high or when the epidemic changes rapidly.
How to interpret results
Peak infected: the maximum of I(t). This is a proxy for maximum concurrent infectious burden.
Time to peak: when I(t) reaches its maximum; depends strongly on β and γ.
Final size: how many people have ever been infected by the end of the simulation, often approximated by R(T) − R₀ (assuming recovered represent cumulative infections in the basic model).
Early growth vs decline: if your initial state yields Re(0) > 1, I(t) will initially increase; if Re(0) < 1, I(t) typically decreases immediately.
To explore interventions conceptually, lowering β (reduced contact/transmission) or raising γ (faster recovery/isolation) reduces R₀ and tends to reduce the peak and total infections.
If you run the simulation long enough, I(t) will rise from 1, reach a peak, and eventually fall as S(t) declines and Re(t) drops below 1. Try decreasing β to 0.15 (keeping γ = 0.1): R₀ becomes 1.5 and the peak should be smaller and later; decreasing β below 0.1 makes R₀ < 1 and I(t) typically shrinks from the start.
Parameter comparison (what changes when you adjust inputs)
Change
Typical effect on the epidemic curve
Why
Increase β
Faster growth, higher and earlier peak; larger total infected
More transmission per S–I contact increases incidence
Decrease β
Slower growth, lower peak; may prevent a major outbreak
Reduces R₀ and Re(t)
Increase γ
Lower peak and shorter outbreak duration
People leave I faster (shorter infectious period)
Increase I₀
Earlier visible outbreak; peak may occur sooner
More initial infectious seed accelerates early dynamics
Decrease Δt
More stable/accurate numerical trajectory (slower to compute)
Reduces discretization error from Euler steps
Assumptions & limitations
Closed population: N is constant (no births, migration). Deaths are not modeled separately unless you interpret “removed” as including deaths.
Homogeneous mixing: everyone is equally likely to contact everyone else; no households, networks, age structure, or geography.
No incubation/latent period: infections become infectious immediately (contrast with SEIR models).
Constant rates: β and γ are treated as fixed over time; real epidemics have changing behavior, seasonality, interventions, and waning immunity.
Deterministic dynamics: randomness is ignored; small outbreaks in small populations can differ substantially from deterministic predictions.
Numerical approximation: Euler stepping can introduce error; very large Δt may produce unstable or unrealistic values.
Not medical advice: this tool is for education and scenario exploration, not for clinical or public-health decision making.
Reference: Kermack, W.O. & McKendrick, A.G. (1927). “A Contribution to the Mathematical Theory of Epidemics.”
Enter parameters and simulate disease progression.
Embed this calculator
Copy and paste the HTML below to add the SIR Epidemic Model Calculator to your website.
Interactive Euler method calculator for first‑order ODEs. Enter f(x,y), initial values, step size, and number of steps to generate a step‑by‑step Euler integ...
Model population change with the logistic equation, explore example scenarios, and copy shareable results for ecology, epidemiology, or market adoption analy...
logistic growth calculatorpopulation dynamicscarrying capacitysigmoid model
Estimate total pay with shift differential for evening, night, and weekend shifts. See base, overtime, and premium pay broken out to compare schedules.