GenerateRandomSearch

SIR Epidemic Simulator

The SIR model is the simplest thing that behaves like an epidemic: people move from susceptible to infected to recovered, and nowhere else. From two rates it produces R₀, an epidemic curve with a peak, and the uncomfortable result that the outbreak turns over not because behaviour changes but because susceptible people run out. This runs it day by day and re-totals the three groups against the population at every step.

What this generator does

Steps the standard SIR equations forward one day at a time from a single initial case, tracking susceptible, infected and recovered counts. Every day is re-totalled against the population and checked for anyone moving backwards.

How to use this tool

  1. Set the population and the contact and recovery rates.
  2. Read R₀ — it is simply one rate divided by the other.
  3. Look at the peak day and how many are infected at once.
  4. Lower the contact rate slightly and watch the peak move and flatten.

Understanding the controls

Population
Everyone starts susceptible except one initial case. A larger population changes the numbers but not the shape of the curve.
Contact rate
Infectious contacts per person per day. This is the rate an intervention like distancing or masking actually reduces.
Recovery rate
The share of infected people who recover each day; its reciprocal is the average infectious period.
Days to simulate
Long enough to see the peak and the tail. If the curve is still rising at the end, extend it.

Common use cases

  • Teaching R₀ as a ratio rather than a mysterious constant
  • Showing why a small change in contact rate moves the peak so much
  • Producing epidemic curve data for a graph or a lesson
  • Exploring why an outbreak turns over before everyone is infected
  • Comparing a growing outbreak against one that never takes off

How this generator works

Each day, new infections are proportional to the product of susceptible and infected counts, and recoveries are proportional to the infected count — both computed from the same snapshot, so the three groups always balance. R₀ is the contact rate divided by the recovery rate: above one the outbreak grows, at or below one it dies out. Before display, every day is re-totalled against the population, and susceptible is confirmed never to rise while recovered is confirmed never to fall.

Randomness and fairness

Nothing here is random. This is a deterministic model, so the same rates always give exactly the same curve — real outbreaks vary, and stochastic models exist for that reason.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Everyone is assumed to mix with everyone else equally, which no real population does — households, workplaces and travel all matter.
  • Recovery grants permanent immunity, so waning immunity and reinfection are not modelled.
  • Rates are constant throughout, so a lockdown, a vaccine or a new variant cannot be represented.
  • This is a teaching model of epidemic dynamics, not a forecast of any real disease, and it should not be used as one.

Privacy and your data

The simulation runs entirely in your browser. No parameter you enter is transmitted, stored or included in analytics.