A lot about the world feels dark right now. We’re reeling from a turbulent presidential race. Processing an attempted assassination. Divided by protests —and a barrage of images on social media that feeds our anxieties.

Sometimes, it seems as though we’re living in the worst of times.

The truth is, we’re really not.

I realize that might seem hard to believe. And, indeed, a robust study shows that most people think that society is declining morally—steadily becoming ruder, greedier and less kind. Yet the study also concludes that people are just as good as they’ve ever been.

The researchers examined decades of studies, some dating as far back as the 1940s, measuring things like empathy , kindness , respect and generosity. They found that although people have been decrying a moral decline for generations, their behavior toward one another really hasn’t changed.

“People think the world has gone to hell in a handbasket,” says Adam Mastroianni, an experimental psychologist and lead author on the study. “But as far as we can tell it’s just the same as it always was.” The title of the study: “ The Illusion of Moral Decline .”

Human beings have been complaining about a moral decline since, well, forever. Jeremiah in the Old Testament, Cicero in ancient Rome, Machiavelli in Renaissance Italy and Cotton Mather in Puritan New England all griped about it, according to Richard Eibach, an associate professor of psychology at the University of Waterloo in Ontario, Canada, who studies how people perceive themselves and the world around them.

Mastroianni and a colleague, Harvard psychology professor Daniel Gilbert, tried to assess whether people think morality is declining, and then whether it actually is.

First, they examined research going back decades from 60 countries, asking people whether they thought others were less friendly, honest, kind or good than they used to be. The studies included approximately 575,000 participants.

Then they looked at research probing how people behave toward one another. The studies asked people whether, for instance, they had recently been treated with respect, done something nice for someone else or donated to charity.

A remarkably consistent portion of people over the years—around 60%—have believed that people are less good now than they were in the past. They also have believed that the moral decline began in their lifetime.

Yet when the researchers looked at actual behaviors over time, they found something different. Year after year, people reported that others do nice things for them. And they do nice things for others.

They also consistently said that their own friends and family members behave better than ever. (Don’t be so surprised. “We ignore their flaws to sustain the relationships,” says Waterloo’s Eibach.)

A survival instinct

Why do we believe that society is worse than it is? It’s partly the way our brains pay attention. We have a negativity bias. We pay much more attention to bad events or emotions than good ones. This is a survival instinct; we need to detect threats.

“The strategy that keeps me vigilant on whether the lion is going to get me keeps me seeing threats everywhere,” says Julia DiGangi, a neuropsychologist in Chicago.

Memory might play a part, too. We often remember the past more fondly than is perhaps warranted. That is because the emotional power of a positive experience stays with us longer than the emotional power of a negative one.

Psychologists call this the Fading Affect Bias and say it makes life more tolerable by helping us defang our bad experiences over time and cherish the good ones.

“You remember what happened, but it doesn’t feel as negative compared to how you felt at first,” says Grant Shields, an assistant professor in the department of psychological science at the University of Arkansas who studies memory.

Getting older might change our perceptions, too. People often see the world as more dangerous and risky during life transitions such as becoming an adult or a parent, studies show.

“Being in a role of responsibility makes people hyper-responsive to misconduct,” says Waterloo’s Eibach, who conducted the research. “And we don’t realize that the world didn’t change—we did.”

Fact-check your assumptions

There’s a danger to believing that people are getting worse when that’s not really true. That belief distracts us from real problems that need to be solved. It makes us susceptible to people in power who want us to believe the worst so they can claim to be the only one who can fix it. And it keeps us from connecting with each other.

“If we believe the worst in people, we treat them in terrible ways,” says Jamil Zaki, a professor of psychology at Stanford University, who has a book coming out on cynicism. “And then we bring out the worst in them.”

His advice: Fact-check your assumptions about others. Talk more about the positive things people do, a practice he calls “positive gossip.” And take a leap of faith on someone: Ask a neighbor for help, give an employee more responsibility, talk to a stranger.

“We’re walking around with a pair of mud-colored glasses on,” says Zaki. “We need to take them off and see each other more clearly.”

Write to Elizabeth Bernstein at Elizabeth.Bernstein@wsj.com