Joel Ginsberg was a sophomore at a college in Dallas when the social anxiety he had felt throughout his life morphed into an all-consuming hopelessness. He struggled to get out of bed, and even the simplest tasks felt herculean.

“The world lost its color,” he told me. “Nothing interested me; I didn’t have any motivation. There was a lot of self-doubt.”

He thought getting some exercise might help, but it was hard to motivate himself to go to the campus gym.

“So what I did is break it down into mini-steps,” he said. “I would think about just getting to the gym, rather than going for 30 minutes. Once I was at the gym, I would say, ‘I’m just going to get on the treadmill for five minutes.’”

Eventually, he found himself reading novels for long stretches at a time while pedaling away on a stationary bike. Soon, his gym visits became daily. If he skipped one day, his mood would plummet the next.

“It was kind of like a boost,” he said, recalling how exercise helped him break out of his inertia. “It was a shift in mindset that kind of got me over the hump.”

Depression is the most common mental illness—affecting a staggering 25 percent of Americans—but a growing body of research suggests that one of its best cures is cheap and ubiquitous. In 1999, a randomized controlled trial showed that depressed adults who took part in aerobic exercise improved as much as those treated with Zoloft. A 2006 meta-analysis of 11 studies bolstered those findings and recommended that physicians counsel their depressed patients to try it. A 2011 study took this conclusion even further: It looked at 127 depressed people who hadn’t experienced relief from SSRIs, a common type of antidepressant, and found that exercise led 30 percent of them into remission—a result that was as good as, or better than, drugs alone.

Though we don’t know exactly how any antidepressant works, we think exercise combats depression by enhancing endorphins: natural chemicals that act like morphine and other painkillers. There’s also a theory that aerobic activity boosts norepinephrine, a neurotransmitter that plays a role in mood. And like antidepressants, exercise helps the brain grow new neurons.