How HazardSim calculates
Every number the simulator shows comes from a few short formulas and a handful of open datasets. This page describes exactly what the code does, including the parts that are rough approximations.
Updated 18 September 2026
HazardSim answers one question: if a disaster of a given size happened here, how much ground would it reach, and how many people live there? It does not say whether such an event is possible there, or how likely. You choose the size; the site applies it to real terrain and settlements with a few simple rules, listed below with the code's constants.
What the simulator answers, and what it doesn't
No fault model decides that a coast can produce a magnitude 9, and no ocean model carries a wave across the Pacific. Results are deterministic: the same place and settings always give the same numbers. The animation is decoration: a flood is computed in one pass, then revealed over about three seconds. Nothing depends on time, so there is no arrival time, warning or evacuation.
The data underneath
Terrain and grid
Elevation comes from Mapbox Terrain-RGB tiles, with Mapbox Terrain-DEM as a fallback. Pixel colours are decoded with Mapbox's published formula, height = −10,000 + (R × 65,536 + G × 256 + B) × 0.1 m. The model mixes sources with different vertical datums, so heights near sea level are not exact, and on a flat coast small errors move the flood line far.
The code picks the most detailed zoom, from 14 down to 6, at which the calculation area is at most 780 pixels wide and 620,000 pixels in total, then loads every whole tile covering it (42 at most). A cell measures 156,543 m × cos(latitude) ÷ 2zoom: at 45° latitude, 6.8 m at zoom 14, 27 m at zoom 12, 54 m at zoom 11. A levee narrower than one cell may not be in the grid at all.
Calculation area
If your point is inside a settlement, the area is its bounding box padded by 14% plus the hazard's reach: wave height × 250 m for a tsunami, 12 km for sea level rise, the outer ring for a meteor (reach capped at 60 km). Height is capped at 1.4° of latitude, less for small hazards; an oversized box is replaced by a square centred on your point. Outside settlements, the area is 82% of the visible map around the point, so zooming can change the result.
City boundaries and population
A click queries Nominatim, the OpenStreetMap geocoder, at zoom levels 10, 12 and 8, keeping the first answer with a boundary polygon. Seas, bays, countries, states and regions are rejected, as is anything over 1.2° tall, 2.4° wide or 12,000 km². Without a polygon, the bounding box is used and its area taken as 72% of the box.
Population comes from the boundary's population tag; failing that, from a Nominatim search for the same name inside the box; failing that, from the largest populated city, town, borough, suburb or village node the Overpass API finds there. Density is population ÷ area, limited to 1–100,000 /km². A result above 60,000 /km² — denser than even the most crowded districts of Dhaka or Manila — means OpenStreetMap has attached a whole city's population to a smaller outline, so the code ignores that figure. With no population in OpenStreetMap, the code uses a typical value for the type of place, from 6,000 /km² for a borough or suburb and 4,500 for a city down to 700 for a village and 300 for a county (2,500 if the type is unknown). The density slider overrides all of it. Administrative boundaries often include farmland, so the average density is usually below that of the centre.
Volcanoes
The red markers are 1,560 records (a few volcanoes appear twice) from the Smithsonian Global Volcanism Program's list of Holocene volcanoes. A point within 40 km of one uses that volcano — the eruption is centred on the volcano itself, not on the click. Farther away nothing is calculated: the site names the nearest real volcano and offers to go there.
Tsunami: a flood-fill that loses height
Coast check. Before a tsunami or sea level run from a click or a search, the code loads coarse terrain (zoom 8, cells of about 600 m at the equator) and counts cells at or below 0.6 m within 30 km. It needs at least 150, roughly 50 km² of open water near the equator (less toward the poles, where cells shrink), which no river or pond reaches. A click on the water itself is refused.
Finding the sea. On the full grid, every edge cell at or below 0.6 m is marked as sea, and the mark spreads through all connected cells, diagonals included, that are also at or below 0.6 m. Fewer than 40 sea cells stops the run. A side effect: land below 0.6 m connected to the sea, such as a polder, starts out as sea and is never counted as flooded.
Spreading the water. From all sea cells at once, water spreads to neighbouring cells, adding one cell width to the distance travelled (1.414 on a diagonal). The water surface at each cell is
level = H − distance ÷ 250
with H the wave height in metres. If the level is above the ground, the cell floods to a depth of level − ground and the water moves on; if not, the cell stays dry and blocks the way. So water reaches a cell only through a chain of flooded cells, and a ridge higher than the water shelters the ground behind it unless there is a way around.
The decay stands in for friction against terrain and buildings. It is one number for the whole planet, not a physical law: on flat land at sea level a 15 m wave stops 3.75 km inland, a 30 m wave at 7.5 km. The same height applies along the whole shoreline of the grid at once, so there is no wave direction, no seafloor, no funnelling in bays, no limited volume of water and no second wave. If water touches the grid edge, the result warns that the real flood goes further.
Send a 15 m wave into Sendai →
Sea level rise: the same engine without decay
Sea level rise runs the same code with the decay switched off: every cell connected to the sea and below the new level floods, however far inland, which is often called a bathtub model. A basin below the new level stays dry if higher ground rings it completely. Dikes count only if they are in the elevation data and wider than a cell. There are no tides, storm surges, erosion or land subsidence, and no timeline. Instead of deaths, everyone living on the flooded land is counted as displaced. See also which cities sea level rise would drown.
Earthquake: intensity rings around a point
The quake is a point source at your click, 8 km deep. Intensity on the Modified Mercalli scale at distance r from the epicentre is
MMI = 1.5·M − 3.0·log10R − 0.0018·R + 1.6, with R = √(r² + 8²) km, limited to 0–12.
The shape is the usual one for intensity attenuation (a magnitude term, geometric spreading, absorption with distance), but the coefficients are the site's own approximation, not a published relation, and intensity is computed directly rather than through ground acceleration. Magnitude 7 gives 9.4 at the epicentre, VIII out to 21 km and V out to 181 km; magnitude 6 peaks at 7.9 and never reaches VIII; magnitude 8 gives VIII out to 67 km. From about magnitude 8.8 the epicentre hits the cap of XII.
Each zone has a share of people killed, multiplied by a construction factor: 0.06 for modern seismic codes, 1 for average, 7 for poor.
| Zone | Modern codes | Average | Poor |
|---|---|---|---|
| IX+: buildings collapse | 0.06% | 1% | 7% |
| VIII: heavy damage | 0.0072% | 0.12% | 0.84% |
| VII: walls crack | 0.00072% | 0.012% | 0.084% |
| VI: things fall over | 0.00006% | 0.001% | 0.007% |
| V: clearly felt | 0 | 0 | 0 |
A real magnitude 9 ruptures a fault hundreds of kilometres long, so strong shaking covers a strip, not a circle. Soft soils, liquefaction, landslides and fires are ignored, and every quake is shallow; a deep one would be felt far more weakly.
Magnitude 7 under Port-au-Prince, poor construction →
Volcano: from VEI to three circles
The Volcanic Explosivity Index becomes an erupted volume: V = 10VEI−5 km³, so VEI 5 is 1 km³ and each step is ten times more. For VEI 2 to 8 this equals the minimum volume of each class in the scale of Newhall and Self (1982); VEI 1 gets 0.0001 km³. Three radii follow:
- pyroclastic flows, max(0.6, 9·V0.25) km: 95% killed;
- 10 cm of ash, enough to collapse roofs, 30·V0.33 km: 0.15% killed;
- 1 cm of ash, 100·V0.35 km: 0.002% killed.
These power laws are the site's own empirical fits.
Real flows follow valleys and real ash drifts downwind in long plumes, so true footprints are lopsided, not circular. Lahars, gases, collapse tsunamis and climate effects are not modelled.
A VEI 5 eruption of Vesuvius →
Meteor: energy and blast scaling
The body is a sphere of diameter D and density 3,000 kg/m³ (stone), 7,800 (iron), 900 (ice) or 1,200 (rubble pile, a loosely bound asteroid like Bennu), arriving at the entry speed you set — 17 km/s by default, a typical value for near-Earth asteroids:
m = ρ·π/6·D³; E = ½·m·v²; yield in Mt = E ÷ 4.184×1015 J
A 150 m stone body gives 183 Mt; the 19 m Chelyabinsk preset 0.37 Mt. The speed control covers 11 to 30 km/s, where nearly all asteroid impacts fall; the Bennu and Apophis presets use 12.7 and 12.6 km/s, the speeds in NASA's Sentry table, so Bennu comes out near 1.4 Gt rather than the 6.4 Gt a 17 km/s stone body of its size would give. The model ignores entry angle and energy lost on the way down. Stone bodies under 70 m, iron under 20 m, rubble piles under 90 m and ice under 150 m count as airbursts and leave no crater; otherwise the crater is 20·D·(ρ/3,000)1/3 across.
For an airburst the code estimates the height of the explosion, falling linearly from 35 km for the smallest stone bodies (12 km for iron, 45 km for ice) to zero at the size where bodies reach the ground: h = hmax·(1 − D ÷ Dairburst). That puts the 19 m Chelyabinsk body at about 25 km and a 60 m Tunguska-class body at 5 km, close to the estimates for both events. The fireball, total-destruction, building-collapse and burn radii are then measured along the slant from the burst point, so on the ground each becomes √(R² − h²), or nothing if R is shorter than h. The windows-shattered ring is left at full size, because a weak shock wave from a high burst spreads widely: over Chelyabinsk glass broke tens of kilometres away. When no building-collapse zone reaches the ground, the windows zone counts no deaths — Chelyabinsk hurt about 1,500 people, mostly with glass, and killed no one.
| Zone | Radius, km (Y in Mt) | 150 m stone | Killed |
|---|---|---|---|
| Crater | half of 20·D·(ρ/3,000)1/3 | 1.5 km | 100% |
| Fireball | 0.9·Y0.4 | 7.2 km | 100% |
| Total destruction (20 psi) | 2.2·Y1/3 | 12.5 km | 90% |
| Buildings destroyed (5 psi) | 4.6·Y1/3 | 26 km | 45% |
| Severe burns | 1.83·Y0.41 | 15.5 km | 18% |
| Windows shattered (1 psi) | 11.6·Y1/3 | 66 km | 0.5% |
Blast radii grow with the cube root of yield, the blast scaling law from Glasstone and Dolan's The Effects of Nuclear Weapons; the coefficients and the fireball power law are the site's own calibration. Heat is handled differently from a nuclear explosion: an impact radiates only a small share of its energy as light, of the order of 0.3% against about 35% for a nuclear weapon, so the burn radius uses the nuclear burn formula (12.8·Y0.41) for a thermal yield of 0.0086·Y, which gives 1.83·Y0.41. Because the share killed may not rise with distance, each zone is raised to at least the value of the zone outside it.
Ocean impacts, their tsunamis and the global effects of bodies over a kilometre are not modelled; see what a meteor does, size by size.
Drop the 19 m Chelyabinsk body on Chelyabinsk →
Hurricane: a storm surge and a wind profile
The slider sets the sustained wind at landfall, from 120 to 320 km/h, which gives the Saffir–Simpson category: 1 from 119 km/h, 2 from 154, 3 from 178, 4 from 209, 5 from 252.
Surge. Each wind speed gets the typical surge of the old Saffir–Simpson table, interpolated between 1.2 m at 120 km/h, 1.8 m at 154, 2.7 m at 178, 4.0 m at 209, 5.5 m at 252 and 7.5 m at 320. The historical presets override it with the surge measured in that storm: Sandy 3.9 m, Bhola 10 m, Katrina 8.5 m, Nargis 4 m, Ian 4.5 m, Haiyan 6 m. The surge then floods the terrain with the tsunami engine, but loses height ten times more slowly — 1 m per 2.5 km — because a surge is a slow rise of the sea over hours rather than a single wave. Deaths on flooded ground use a gentler curve than the tsunami, from 0.1% below half a metre to 45% above 6 m; Galveston in 1900, where a 4.6 m surge with no warning killed about a quarter of the island, sits in the middle of it.
Wind. Outside the eyewall the wind falls with the square root of distance, v(r) = Vmax·(Rmax/r)0.5, so the radius where it drops to a threshold v is Rmax·(Vmax/v)². The radius of maximum wind comes from Willoughby and Rahn (2004): Rmax = 46.4·e−0.0155·V + 0.0169·|latitude| km with V in m/s, kept between 10 and 80 km. The rings mark category 5, 4 and 3 winds, hurricane force (119 km/h) and gales (63 km/h). Wind itself kills few people, so the shares are small: 0.05% of the people inside category 5 winds, 0.015% in category 4, 0.004% in category 3, 0.0005% in hurricane-force wind and none in gales.
The storm is symmetric and does not move: the real surge is highest to the right of the track in the northern hemisphere, and rain flooding, tides, waves on top of the surge and levees are not modelled.
Bring Katrina's 8.5 m surge to New Orleans →
How people are counted
The city's density applies inside a circle of the same area as the city (6 km radius if none was found). Beyond it, density decays toward 60 people per km², a rough average for inhabited land:
density(r) = 60 + (D − 60)·e−(r − R)/(0.8R + 2)
with D the slider density, R the city radius and r the distance in km. Without it, a 1 km meteor would kill more people than live on Earth.
Floods. Each flooded cell adds cell area × density × a share killed that depends on depth, with distance measured from the centre of the terrain grid rather than your click. For sea level rise the share is 1, reported as displaced.
Rings. For quakes, eruptions and impacts, the disc inside the outer ring is cut into 800 thin annuli, each holding 2πr × width × density × land share (the fraction of terrain-grid cells above 0.6 m). Meanwhile, if the outer radius is 450 km or less, the code asks the Overpass API for every city and town with a population tag in a square around the point. If any are found, the background drops to 60 /km² and each town's full population is added at the distance of its centre point. A quick estimate appears first and is refined when the list arrives.
Totals are capped at 8.2 billion. Everyone is assumed to be at home, unwarned and not evacuated.
Limits: why these are orders of magnitude
- Imperfect terrain. Height errors and cells tens of metres wide decide where floods stop on low coasts.
- Averaged population. Uniform density inside boundaries, towns as single points, censuses of different years.
- Fixed death shares. Real tolls depend on warning, time of day, buildings and rescue. A magnitude 6.7 killed 57 people in Northridge, California, in 1994; a magnitude 7.0 killed more than 100,000 in Haiti in 2010.
- Point airbursts. A real airburst spreads its energy along tens of kilometres of track at a slant; the model treats it as a single point at an estimated height straight above your click.
Use a result to tell hundreds from hundreds of thousands, or to see which parts of a city sit low, not as a count.
Data licences and attribution
- Boundaries, place names, population: © OpenStreetMap contributors, Open Database License (ODbL), queried through Nominatim and the Overpass API.
- Elevation, satellite imagery, base maps, search: © Mapbox, under the Mapbox Terms of Service; imagery and map data providers are credited on the map.
- Volcanoes: Smithsonian Institution, Global Volcanism Program, Volcanoes of the World.
- Map on the recent launches page: OpenFreeMap tiles (OpenMapTiles schema), data © OpenStreetMap contributors.
Sources and data
- Mapbox — Terrain-RGB v1 tileset reference
- Mapbox — Terrain-DEM v1 tileset reference
- Mapbox — Terms of Service
- OpenStreetMap — Copyright and License
- Open Data Commons — Open Database License
- OpenStreetMap Foundation — Nominatim usage policy
- OpenStreetMap Wiki — Overpass API
- Smithsonian Institution, Global Volcanism Program — Volcanoes of the World
- OpenFreeMap and OpenMapTiles
- Glasstone and Dolan (1977) — The Effects of Nuclear Weapons, 3rd edition
- Newhall and Self (1982) — The volcanic explosivity index (VEI), Journal of Geophysical Research 87
- USGS — The Modified Mercalli Intensity Scale
- National Hurricane Center — The Saffir-Simpson Hurricane Wind Scale
- Willoughby and Rahn (2004) — Parametric representation of the primary hurricane vortex, Monthly Weather Review 132
- Rappaport (2014) — Fatalities in the United States from Atlantic tropical cyclones, Bulletin of the American Meteorological Society 95
- Collins, Melosh and Marcus (2005) — Earth Impact Effects Program, Meteoritics & Planetary Science 40 (a more physical impact model, for comparison; not used by HazardSim)