
An accidental discovery by alchemists seeking immortality — and the chemistry that changed warfare forever.
The Search for Immortality
In the 9th century CE, during the Tang Dynasty, Chinese alchemists were obsessed with a single goal: finding the elixir of immortality. They believed that the right combination of minerals, heated in the right way, would produce a substance that could extend human life forever.
They tried thousands of combinations. They mixed mercury with jade. They heated arsenic with gold. They combined sulphur with saltpetre. Most of their concoctions were useless. Some were poisonous — several emperors died from taking alchemical "elixirs" that contained mercury or lead.
But one combination did something entirely unexpected.
Around 850 CE, an anonymous alchemist — recording his experiments in a text called the Zhenyuan miaodao yaolüe — noted a mixture that should be avoided at all costs: sulphur, saltpetre (potassium nitrate), and charcoal. When heated together, this mixture did not produce an elixir. It produced a violent flash, a loud bang, and singed the alchemist's hands and face.
The text warns: "Some have heated together sulphur, realgar, and saltpetre with honey; smoke and flames result, so that their hands and faces have been burnt, and even the whole house burned down."
The alchemists were looking for immortality. They found gunpowder.
The Chemistry
Gunpowder is a mixture of three substances in specific proportions: approximately 75% potassium nitrate (KNO₃), 15% charcoal (carbon), and 10% sulphur.
Each component has a specific role:
Potassium nitrate (saltpetre) is the oxidizer. It provides the oxygen needed for combustion, which is why gunpowder can burn in an enclosed space — or even underwater. The oxygen comes from the nitrate (NO₃⁻) ion, not from the air. This is what makes gunpowder fundamentally different from ordinary fire, which stops burning when deprived of air.
Charcoal (carbon) is the fuel. It burns (combines with oxygen) to produce carbon dioxide and heat.
Sulphur is the secondary fuel and reaction accelerator. It has a low ignition temperature (approximately 240°C, compared to charcoal's 300°C), which means it catches fire first and then ignites the charcoal. It also produces sulphur dioxide gas, which contributes to the expansion that makes gunpowder an effective propellant.
The overall reaction is approximately:
2KNO₃ + 3C + S → K₂S + 3CO₂ + N₂
The products are solids (potassium sulphide) and gases (carbon dioxide and nitrogen). The gases occupy about 3,000 times more volume than the original solid mixture. This sudden, violent expansion of gas is what creates the explosion.
From Fireworks to Weapons
The Chinese did not immediately use gunpowder for weapons. For more than a century, it was used primarily for fireworks and signal flares — the earliest "fire arrows" were conventional arrows with small bags of gunpowder tied to the shaft, used to set fire to enemy fortifications.
The first true gunpowder weapon was the fire lance — a bamboo tube packed with gunpowder and shrapnel, attached to a spear. When lit, it produced a jet of flame and projectiles at close range. By the 12th century, Chinese armies were using bombs (gunpowder packed in iron or ceramic shells), rockets (tubes of gunpowder with a stick for stability), and the earliest cannons (bronze tubes that fired stone or iron balls).
The critical insight — the step from firework to weapon — was containment. Gunpowder burned in the open produces a flash and a bang. Gunpowder contained in a sealed vessel produces an explosion, because the gases have nowhere to go. Gunpowder contained in a tube with one open end and a projectile produces a gun — the gases expand, pushing the projectile out at high velocity.
The Spread
Gunpowder reached the Islamic world by the 13th century, probably via the Mongol conquests and the Silk Road trade routes. Arab chemists documented the recipe and improved the formulation — they discovered that purifying the saltpetre (dissolving it in water, filtering out impurities, and recrystallizing) produced a more powerful mixture.
It reached Europe by the mid-13th century. The English friar Roger Bacon described the recipe in 1267 (encrypted in an anagram to keep it secret). By the 14th century, European armies were using cannons — and the age of castles, knights, and feudal warfare was coming to an end. No stone wall could withstand a sustained bombardment. No armoured knight could survive a musket ball.
The Lesson
Gunpowder is a reminder that chemistry is not morally neutral. The same reaction that delights a crowd at a fireworks display can destroy a city. The same understanding of oxidation, ignition temperature, and gas expansion that enables a beautiful Roman candle also enables a cannon.
The Chinese alchemists wanted immortality. What they found was a mixture that would, over the following millennium, kill more human beings than any other invention in history — until the nuclear weapons that the Manhattan Project built eight centuries later.
Science gives us power. What we do with it is not a chemistry question. It is a human one.
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import numpy as np
import matplotlib.pyplot as plt
# Your first data analysis with Python
data = [45, 52, 38, 67, 41, 55, 48] # measurements
mean = np.mean(data)
plt.bar(range(len(data)), data)
plt.axhline(mean, color='red', linestyle='--', label=f'Mean: {mean:.1f}')
plt.xlabel("Sample")
plt.ylabel("Value")
plt.title("Combustion Chemistry & Gas Laws — Sample Data")
plt.legend()
plt.show()This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build a Propellant Chemistry Simulator.
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.
The chemistry of gunpowder — oxidizers, fuels, gas expansion, and the physics of containment and propulsion.
The big idea: "Chinese Gunpowder" teaches us about Combustion Chemistry & Gas Laws — and you don't need to write a single line of code to understand it.
Light a match. It burns brightly in open air. Now put it in a sealed glass jar. After a few seconds, the flame dies — it has consumed all the oxygen in the jar. Ordinary fire needs air because it needs the oxygen in the air to sustain the combustion reaction.
Gunpowder is different. It contains its own oxygen supply — potassium nitrate (KNO₃, also called saltpetre). The nitrate ion (NO₃⁻) is packed with oxygen atoms. When heated, it releases those oxygen atoms, allowing the fuel components (charcoal and sulphur) to burn even in a sealed space — or underwater.
This is the distinction between an ordinary fuel (needs air) and a propellant (carries its own oxidizer). Fireworks, rocket fuel, and gunpowder are all propellants — they work in sealed tubes, underwater, and even in the vacuum of space.
The recipe — approximately 75% potassium nitrate, 15% charcoal, 10% sulphur — has remained nearly unchanged for a thousand years because it represents the optimal balance: enough oxidizer to burn all the fuel, enough fuel to produce maximum gas, and just enough sulphur to lower the ignition temperature for reliable firing.
Check yourself: A candle in a sealed jar goes out. A lit sparkler in a sealed jar keeps burning (briefly). Why the difference? (The sparkler contains its own oxidizer — potassium nitrate, mixed into the coating. The candle relies on oxygen from the air.)
Key idea: Gunpowder carries its own oxygen in the form of potassium nitrate (saltpetre). This means it can burn in sealed spaces, underwater, and in a vacuum — unlike ordinary fire, which depends on air. This self-oxidizing property is what makes it a propellant rather than just a fuel.
Blow up a balloon. The air inside pushes outward against the rubber, stretching it. Now imagine the air inside suddenly multiplied by 3,000 — the balloon would burst violently.
That's essentially what gunpowder does. The solid powder (a few grams) reacts to produce gases (carbon dioxide and nitrogen) that occupy 3,000 times more volume than the original solid. If this happens in an open space, you get a flash and a whoosh. If it happens in a sealed container, the gases have nowhere to go — pressure builds until the container ruptures. That's an explosion.
And if it happens in a tube with one open end (a gun barrel or rocket nozzle), the gases push out the open end, accelerating anything in front of them — a bullet, a cannonball, or the rocket itself.
The ideal gas law — PV = nRT — tells you the pressure: n is the number of moles of gas produced, R is a constant, T is temperature (very high — combustion produces temperatures above 2,000°C), and V is volume. In a fixed volume (sealed chamber), more gas and higher temperature mean higher pressure.
Think about it: A car airbag inflates in about 30 milliseconds. It uses a chemical reaction (sodium azide decomposing) to produce a large volume of nitrogen gas almost instantly. Same principle as gunpowder — solid → gas → rapid expansion.
Key idea: When gunpowder burns, solid reactants become gases that occupy 3,000× more volume. In the open, this is a flash. In a sealed container, it's an explosion. In a tube, it's a propellant. The behaviour depends entirely on containment — the chemistry is the same.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
The Chinese used gunpowder for **fireworks** for over a century before anyone used it for warfare. The transition from entertainment to weapon was not...