system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How is gasoline different from diesel, and why does it damage the car if you put the wrong kind in the tank?
gpt
Spark ignition and diesel engines achieve combustion differently. Spark ignition ignites the fuel-air mixture with a spark plug, whereas diesel engines ignite fuel by compressing the fuel until it ignites on it's own.

This leads to different requirements from the fuel. Spark ignition engine fuel has to survive compression and ignite only when the spark plug fires, whereas heavy fuels for diesel engines have to ignite under compression.

Gasoline and diesel are optimized for each of these two engine cycle types. This is also what the octane rating gasoline fuel is dealing with; there's an additive that slightly changes the resistance to compression, and so gasoline with a higher octane rating can be used in engines with slightly more compression prior to the spark plug firing, which ends up being a higher performance engine. Also, contrary to popular belief, higher octane rating gasoline does **not** mean it's a "better" fuel. It only means its rated for use in higher performance engines.

Anyway, using the wrong fuel in the engine can lead to issues. Gasoline in a diesel engine will detonate really really early, causing damage to the internals of the engine. Diesel in a gasoline engine can actually function, but most of the fuel won't burn. You can end up with a serious amount of gunky partially-combusted diesel coating the internals of the engine, which can interfere with the oil on the cylinder walls or end up in the crankcase, which will cause damage over time if not cleaned up pretty quickly.

Of note though; each of those fuels *can* be used in the other kind of engine with modifications and proper control and calibration, but it's somewhat difficult and not something the layman would be able to do on their own.