What makes it tick

The four-stroke engine, opened up

GitHub

How an engine works

Everyone has heard an engine idle. Almost nobody has seen the small, precisely timed fire it lights hundreds of times a minute. Here is one, slowed right down.

01

A push, turned into a spin

You are looking at one cylinder of a car engine, cut open. A piston slides up and down inside a tube. Above it sit two valves and, depending on the fuel, a spark plug or an injector. Below it a connecting rod links the piston to the crankshaft, the shaft that eventually turns the wheels.

The whole idea fits in one sentence: burn fuel in a sealed space, let the hot gas push the piston down, and turn that push into rotation. Everything else in the engine exists to repeat this cleanly, over and over.

It repeats as a cycle of four steps called strokes. The dial in the corner shows where the engine is in that cycle. The model runs in slow motion: a real car engine idles at around 800 turns a minute and can spin eight times faster than that.

Drag the model to look around it and scroll over it to zoom. As you read on, the view follows the text.

02

Four strokes

A stroke is one trip of the piston from the top of the cylinder to the bottom, or back. The top is called top dead centre (TDC) and the bottom bottom dead centre (BDC): dead, because the piston stops there for an instant before it changes direction.

  1. Intake

    The piston moves down with the intake valve open, and the growing space draws in fresh charge. A petrol engine takes in air already mixed with fuel. A diesel takes in plain air.

  2. Compression

    Both valves shut and the piston rises, squeezing the charge into a tenth of its volume or less. Squeezing a gas heats it, so the charge is several hundred degrees hot before anything has burned.

  3. Power

    Near the top, the charge is lit. A petrol engine fires a spark. A diesel sprays fuel into air that is already hot enough to light it. The burning gas expands and shoves the piston down. This is the only stroke that makes power.

  4. Exhaust

    The exhaust valve opens and the rising piston pushes the burnt gas out, leaving the cylinder ready to start again.

Keep an eye on the gas: fresh charge comes in cool, turns hotter as it is squeezed, flares orange as it burns and leaves grey.

03

Two turns for every push

Each stroke takes half a turn of the crankshaft, so the four strokes take two full turns: 720 degrees. That is why the dial counts to 720 rather than 360.

The piston reaches the top twice in every cycle: once at 0°, between exhaust and intake, and once at 360°, when the charge is fired. The piston cannot tell the two apart. Only the valves and the spark know which is which.

Only one stroke in four pushes. Drawing in air, squeezing it and pushing out exhaust all cost work, and for those three strokes the engine has to be carried. The momentum of the moving parts does some of that, and the flywheel does the rest: a heavy disc on the end of the crankshaft that soaks up energy during the power stroke and hands it back during the other three.

That is why a one-cylinder engine feels lumpy: one hard shove every second turn, and nothing in between. Lawnmowers use a heavy flywheel to smooth it out. Cars add more cylinders, which we will come to.

04

Valves and cams

Each valve is a mushroom-shaped plug. A spring holds it shut against its seat, and a cam pushes it open: an egg-shaped lobe on a spinning shaft. As the bump comes round it presses the valve down into the cylinder. As it passes, the spring pulls the valve shut again.

Each valve opens once per cycle, and a cycle is two turns of the crank. So the camshaft turns at half crank speed, driven by a belt or chain. Watch the cams: one turn for every two of the crank.

Valves that opened and closed exactly at the dead centres would make the engine breathe badly. Gas has weight and takes time to get moving, so the timing is stretched. The exhaust valve opens early, well before bottom dead centre, so the still-pressurised gas can blow out on its own. The intake valve closes late, well after bottom dead centre, because the incoming air is still rushing in even as the piston starts back up.

Around the top, between exhaust and intake, both valves are open at once for a moment. This valve overlap lets the outgoing exhaust help draw the fresh charge in behind it.

Valve lift over one cycle for the current engine. The strip wraps around: its right edge joins its left edge, and the shaded bands are where both valves are open.

05

Lighting the charge

Burning is not instant. In a petrol engine, a flame starts at the spark plug and spreads across the chamber in a few thousandths of a second, which is a real slice of a turn. The push is most useful just after top dead centre, so the spark has to jump early: roughly 10 to 40 degrees before top dead centre.

How early depends on speed. The flame needs about the same time whatever the engine is doing, but at higher revs the crank turns through more degrees in that time, so the spark is advanced as the engine speeds up. Fire too early and the pressure fights the rising piston. Fire too late and it chases a piston that is already on its way down.

A diesel has no spark plug. Compression heats the air past about 700 °C, and shortly before top dead centre the injector sprays fuel into it. The fuel takes a moment to vaporise and catch, a short ignition delay, and then burns about as fast as it is injected. The burn is stretched out over the injection instead of racing across the chamber in one flame front.

The graph shows the result. Petrol pressure climbs to a sharp peak just after the top. Diesel starts from a much higher squeeze, and its burn holds the pressure up while the piston starts down.

Cylinder pressure through compression and power, compared with the air outside. Intake and exhaust stay close to 1× and are left out. The bold curve is the engine on screen, and the line follows it live.

06

From push to spin

The connecting rod joins the piston to an offset pin on the crankshaft, the crank pin. As the pin swings round in a circle, the rod turns the piston's straight push into rotation, the way your leg turns a bicycle pedal.

The piston does not move in a smooth sine wave. The rod tilts as the pin swings out to the side, which pulls the piston further down than the pin's own drop. At 90 degrees of crank the piston is already past halfway: about 50 of its 86 mm. So it moves faster near top dead centre than near bottom dead centre, and it reaches top speed before the crank has turned 90 degrees.

At 3,000 rpm that top speed is about 14 m/s, and the piston stops dead and reverses twice every turn. Heavy counterweights opposite the crank pin balance the spinning mass of the pin and rod, so the engine does not shake itself apart.

Piston position and speed over one turn of the crank. The dashed lines show what a rod that never tilted would do.

07

How hard to squeeze

The compression ratio compares the space above the piston at bottom dead centre with the space left at top dead centre. At 10 : 1, the charge is squeezed into a tenth of the room it had.

A higher ratio lets the burning gas expand further, so more of its heat turns into push: more work from the same fuel. So why not squeeze harder? A petrol engine compresses fuel and air together, and squeezing heats them. Go too far and pockets of mixture light themselves before the flame arrives, a sharp knock that can crack pistons. That keeps petrol engines at roughly 9 to 13 : 1.

A diesel squeezes only air, so there is nothing to light early, and it needs the heat: the air must be hot enough to ignite the fuel. Diesels run at about 14 to 22 : 1.

10.0 : 1
Gap above the piston
9.6 mm
Pressure before burning
20×

The model pauses at top dead centre here, so you can watch the gap above the piston shrink as you raise the ratio.

08

Petrol or diesel

Both engines run the same four strokes. They differ in how the fuel gets in and what lights it.

Feature Petrol Diesel
Fuel gets in Mixed with the air on its way in, or sprayed in during intake Injected straight into hot air at the end of compression
What lights it A spark The heat of compression
Compression ratio 9 to 13 : 1 14 to 22 : 1
Power is set by A throttle that limits the air How much fuel is injected
Typical top speed 6,000 to 7,000 rpm 4,000 to 5,000 rpm

A diesel is more efficient for three reasons. It squeezes harder, so each drop of fuel does more work. It runs lean, with far more air than the fuel needs. And it has no throttle, so it never wastes effort sucking air past a half-closed flap.

A petrol engine revs higher and runs smoother. Its mixture is ready to burn the moment the spark fires, and the flame is quick. Its lower pressures allow lighter parts that are happy to spin fast. A diesel waits for its fuel to mix and catch, and when it does the pressure jumps, which is the source of its familiar clatter.

A hybrid pairs an engine like this with an electric motor that helps it along, lets it switch off when it is not needed and recovers energy when braking. That is a chapter this explainer does not have yet.

09

Four cylinders

One cylinder gives one shove every two turns. Four cylinders sharing a crankshaft, each at a different point in the cycle, give a shove every half turn: a power stroke every 180 degrees instead of every 720. The push on the crank is far steadier, so the flywheel can be much lighter.

The crank pins are arranged so pistons 1 and 4 move together, and 2 and 3 move together in the opposite direction. When the outer pair rises the inner pair falls, so their main up-and-down forces cancel out.

Pistons that move together are never on the same stroke. When piston 1 fires, piston 4 is at the top too, finishing its exhaust. The cylinders fire in the order 1-3-4-2, which alternates between the ends of the crankshaft and spreads the pulses evenly along it.

Each row is one cylinder over a full cycle, coloured by stroke. The power strokes step along by 180 degrees.

10

Controls

Everything on the page works from the keyboard as well.

Space Play or pause
1 2 3 4 Jump to intake, compression, power or exhaust
← → Step the crank 2°, or 15° with Shift
↑ ↓ Speed up or slow down
C Cutaway on or off
G Gas colours on or off
L Labels on or off
F Gas flow arrows on or off
E Switch between petrol and diesel
M Switch between one cylinder and the inline four
R Reset the camera
Drag Orbit around the engine
Scroll or pinch Zoom in and out

Numbers come from a small model of a half-litre cylinder with an 86 mm bore, an 86 mm stroke and a 145 mm connecting rod. Pressures are simplified: good for shapes and proportions, not for exact figures.