Here’s some info you’ll want to share with your news feed: A study of 12 million Facebook users suggests the social-networking site is associated with a longer life—that is, as long as it’s used to enhance, and not replace, real-life social interactions.

Plenty of research has examined the impact of social media use on health and well being, with conflicting results. Some studies have found that sites like Facebook can make users depressed, affect self-esteem, and increase feelings of insecurity. Others show that something as simple as a comment from a virtual friend can be a significant mood booster.

When it comes to longevity, social scientists have long known that people with larger real-life social networks have the upper hand. But no studies, to date, have looked at whether online friendships play a significant role, as well.

“I think our findings speak to a debate that has taken place between people who think that social media usage is bad for us and those who think it’s good for us, and that debate has not always been based on evidence,” co-author James Fowler, Ph.D., professor of political science and global public health at UC San Diego, told RealSimple.com. “This is some of the first evidence we have that shows that people who use social media more are healthier.”

The key to reaping those health benefits? The right amount—and the right type—of activity.

"Interacting online seems to be healthy when the online activity is moderate and complements interactions offline," co-author William Hobbs, PhD, who worked on the study as a UC San Diego doctoral student and is now a postdoctoral fellow at Northeastern University, said in a press release. "It is only on the extreme end, spending a lot of time online with little evidence of being connected to people otherwise, that we see a negative association."

To reach these conclusions, Fowler and Hobbs matched Facebook users living in California with records from the state department of public health. (To protect users’ privacy, all identifying data was removed from the analysis.) They studied participants’ Facebook activity over six months, comparing the posting habits of those still living to those of similar age and gender who had died.

First, they found that, in any given year, the average Facebook user was about 12 percent less likely to die than someone who doesn’t use the site. The researchers acknowledge, though, that this could be due to other circumstances—like social or economic differences between the two groups—and not a result of Facebook use itself.

They then focused in on people who did use Facebook regularly, controlling for factors such as age, gender, relationship status, length of time on Facebook, and whether they used a computer or smartphone to access the site.

In this analysis, people who were tagged in and posted more photos—suggesting higher levels of offline, face-to-face social activity—tended to live the longest. When it came to online-only social interactions, like wall posts and private messages, moderate levels were associated with the lowest risk of death.

On the other hand, people who used Facebook at extreme levels, and who focused on online-only interactions rather than photos, were more likely to die during the study period.

“It wasn’t really surprising to find that moderate usage of these tools, especially in the service of supporting those face-to-face relationships that we already knew made us healthy, appears to be good for us,” says Fowler.

Having a larger social network was also linked to longer life. But the real influencing factor seemed to be the number of friend requests a person received—not the number they sent.

That was disappointing for Fowler, who wants to learn how to use social networks to make people healthier. “We can tell people to go out and seek support from new friends,” he says, “but the fact that we didn’t find a link between health and the number of friend requests sent suggests that interventions in that direction won’t work.”

Hobbs and Fowler were not able to determine any cause-and-effect relationships between Facebook use and longer life; in fact, they say their most surprising finding—the lack of association between initiating friendships and longer life—suggests that there probably isn’t a causal link.

The good news? We can probably stop worrying so much about potential consequences.

"Happily, for almost all Facebook users, what we found is balanced use and a lower risk of mortality,” Fowler says. “And it’s possible that that social media has nothing to do with our health. But it would be very, very surprising to me, at this point, to find out that social media is bad for us in a widespread, systematic way.”

The study, which also includes co-authors from Facebook and Yale University, is published in the Proceedings of the National Academy of Sciences. Fowler says he’d like to see this research—just like that initial 1979 study on real-life friendships and longer life—inspire many follow-ups. And because social media evolves so quickly, he'd like to see studies reexamine Facebook as it exists today (the data published today was collected between 2011 and 2013), as well as newer social-media platforms.

“Social relationships seem to be as predictive of lifespan as smoking, and more predictive than obesity and physical inactivity,” he says. “We're adding to that conversation by showing that online relationships are associated with longevity, too."

 

This article originally appeared on Time.com.