How Does a Penis Get Hard? The Biology Explained

An erection happens when blood fills two spongy chambers inside the penis and gets trapped there under pressure. The process involves your brain, nervous system, blood vessels, and a precise chemical chain reaction, all working together in a sequence that takes just seconds. Here’s how each piece works.

Two Ways an Erection Starts

Your body can trigger an erection through two distinct pathways, each using different nerves in the spinal cord. A psychogenic erection starts in the brain, triggered by something you see, hear, imagine, or remember. These signals travel down through the spinal cord at the mid-back level (T11 through L2) before reaching the penis. A reflexogenic erection bypasses the brain entirely and is triggered by direct physical touch to the genitals. That signal loops through the lower spinal cord (S2 through S4) and back without needing any input from the brain at all.

This distinction matters in real life. Men with complete spinal cord injuries above the mid-back can often still get erections from direct touch, even though they can’t get one from visual or mental arousal. Both pathways converge on the same destination: the smooth muscle tissue inside the penis.

The Chemical Chain Reaction

Once the nervous system sends its signal, a specific chemical sequence unfolds inside the penile tissue. Nerve endings and blood vessel walls release a gas called nitric oxide. This molecule triggers an enzyme that produces a second chemical messenger called cGMP. That messenger is the key: it tells the smooth muscle cells lining the blood vessels and internal chambers of the penis to relax.

This relaxation is what makes everything else possible. In its resting state, the smooth muscle in the penis is contracted, keeping blood vessels narrow and blood flow minimal. When cGMP tells those muscles to relax, the arteries widen and blood rushes in.

How Blood Gets Trapped

The penis contains two cylindrical chambers called the corpora cavernosa, running side by side along its length. These chambers are filled with a network of tiny expandable spaces, like a dense sponge. When the smooth muscle relaxes and arteries open up, blood floods into these spaces and they expand.

Here’s what creates the actual rigidity: both chambers are wrapped in a tough, fibrous outer shell. As the spongy tissue swells with blood, it presses the small veins that normally drain blood out of the penis against this outer shell, pinching them shut. Blood keeps flowing in through the arteries but can’t escape through the veins. The result is a hydraulic system under pressure. Healthy arterial blood flow during an erection reaches speeds of 30 centimeters per second or more, compared to the minimal trickle during the flaccid state.

How an Erection Ends

The same system that builds an erection also has a built-in off switch. An enzyme called PDE5, which is present throughout the smooth muscle of the penis, constantly breaks down cGMP. During arousal, the body produces cGMP faster than PDE5 can destroy it, so the erection holds. Once arousal fades, or after ejaculation triggers a surge of activity from the sympathetic nervous system (the branch responsible for the “fight or flight” response, which is inherently anti-erection), cGMP production drops. PDE5 quickly breaks down what’s left, the smooth muscle contracts again, blood vessels narrow, the veins reopen, and blood drains out.

This is also why common erectile dysfunction medications work. They block PDE5, slowing the breakdown of cGMP so that the chemical signal to stay relaxed lasts longer. They don’t create arousal on their own. They just make it easier for the existing signal to do its job.

The Role of Testosterone

Testosterone doesn’t directly trigger erections, but it maintains the machinery that makes them possible. It supports the health of smooth muscle tissue, nerve signaling, and nitric oxide production. Men with total testosterone above roughly 350 ng/dL generally have enough hormonal support for normal erectile function. Below about 230 ng/dL, problems become common and testosterone replacement often helps. The gray zone between those numbers varies from person to person.

Erections During Sleep

Healthy men get erections during sleep regardless of what they’re dreaming about. These happen during REM sleep cycles, and a typical night includes four or five of them. Each cycle of nighttime erection activity lasts about 85 minutes on average, with the erection itself lasting roughly 25 minutes per cycle. In teenage boys, these sleep erections account for over 30% of total sleep time. By ages 60 to 69, that drops to around 20%. These erections are one reason doctors can distinguish between physical and psychological causes of erectile problems: if they still happen at night, the plumbing likely works fine.

Why Erections Become Less Reliable With Age

Erectile difficulty affects about 18% of men over age 20 in the United States, totaling roughly 18 million men, with the highest rates between ages 40 and 69. The reasons are mostly vascular. The same processes that narrow arteries elsewhere in the body (from high blood pressure, high cholesterol, diabetes, or smoking) also affect the small arteries feeding the penis. Since those arteries are narrower than coronary arteries, they often show damage earlier. Erectile problems can actually be an early warning sign of cardiovascular disease years before a heart attack or stroke.

Nerve damage from diabetes or surgery, declining testosterone, medications for blood pressure or depression, and psychological factors like stress or anxiety can all interfere with different steps in the process. Because an erection requires the brain, spinal cord, nerves, blood vessels, smooth muscle, and hormones to all cooperate in sequence, a problem at any single point can disrupt the whole chain.