Touch a hot pan and your hand jerks away before you feel it hurt. Pain is a message, and it travels along nerve cells from the place that is hurt to your brain.
Your skin, muscles, joints and organs hold millions of nerve endings that sense harm: strong heat, a hard squeeze, a cut, or molecules spilled from damaged cells. They are called nociceptors, from the Latin nocere, to harm. Each one is the branched end of a single nerve cell whose long, thin fibre runs all the way to your spinal cord.
In the spinal cord, the fibre meets a second nerve cell. As with dopamine and serotonin in the brain, the signal crosses the narrow gap between them as molecules: the first cell releases a neurotransmitter, mostly glutamate, which fits receptors on the next cell. That cell carries the signal up to your brain, and your brain turns it into the feeling of pain. Other nerve cells in the spinal cord send a signal straight back to the muscles of your arm, and that is why your hand moves first.
Electricity carried by ions
Along the fibre, the signal is a tiny pulse of electricity. In a copper wire, electricity is a flow of electrons. In a nerve, it is a flow of ions. Pumps in the wall of the fibre, the pumps that run on ATP, keep sodium ions, Na⁺, the same ions as in table salt, mostly outside. Outside the fibre there are about ten times as many of them as inside.
The wall also holds proteins called sodium channels, each with a narrow pore that lets sodium ions through. When a channel opens, sodium ions rush in and carry their positive charge into the fibre. That charge opens the channels just along the fibre, and those open the next ones, so a wave of opening channels runs along the fibre. Each channel closes again within about a thousandth of a second, and moments later it is ready for the next signal.
At an injury
Damaged cells release many molecules. Among them are the prostaglandins, messengers that bring on pain, swelling and fever. At an injury, prostaglandins make the nerve endings more sensitive, so they send signals more readily. That is why sunburnt skin hurts at the lightest touch.