“When I scroll through page after page of my friends’ descriptions of how accidentally eloquent their kids are, and how their husbands are endearingly bumbling, and how they’re all about to eat a home-cooked meal prepared with fresh local organic produce,” Stephen Marche confessed in The Atlantic in 2012, “I do grow slightly more miserable. A lot of other people doing the same thing feel a little bit worse, too.”

“The question of the future is this,” Marche wrote. “Is Facebook part of the separating or part of the congregating; is it a huddling-together for warmth or a shuffling-away in pain?”

The most accurate answer may be: It depends how you use it.

Past studies have shown that a steady stream of happy updates from friends can make a person feel isolated, unhappy, and generally more dissatisfied with the circumstances of their own lives. But social media also encapsulates the full range of human emotion, and for every person in your News Feed reminding you that they’re #blessed, there’s another one tacking sad-face emojis onto a post about how much they hate their job or tweeting thinly-veiled barbs at an ex.

Like many things, our online activity—including whose profiles we choose to view—is dictated in large part by our moods. New research suggests that there’s a flip side to Marche’s social media-induced melancholy: For those feeling down in the dumps, Facebook and similar sites can also offer a nastily satisfying pick-me-up. A study recently published in the journal Computers in Human Behavior found that when people feel bad about themselves, they’re more likely to look up the people in their networks who seem to be doing worse.

Researchers nudged 168 college students into good or bad moods by having them complete a computer task that tested their ability to recognize emotionally ambiguous faces. Regardless of their answers, half of the students were told they aced the task (good mood), while the other half were told they did terribly (bad mood). The participants were then asked to view a mockup of a fake website called SocialLink, which the researchers told them was a prototype for a new social-networking site for university alumni. The homepage for the site contained eight profiles, each of which was accompanied by two sets of ratings: a row of dollar signs, labeled “Career Success,” and a row of hearts, labeled “Hotness Rating.” (Notably, the study doesn’t mention whether the students found it odd that their school would be asking its alums to rate each other on hotness, but that’s an issue for another day.)

In designing the site, the researchers took pains to ensure that the randomly-assigned high or low ratings were the only things by which the profiles could be judged: The photos were blurred out, and each fake user had roughly the same amount of “friends.” When the students clicked into the profiles, each one featured a stream of similarly mundane posts of the here’s-what-I-had-for-lunch variety:

Computers in Human Behavior

When they controlled for the amount of time that the students usually spent on social media, the researchers found that the students in bad moods spent more time than their more cheerful counterparts browsing the profiles of less attractive and less successful users (and, conversely, less time looking at the profiles of more attractive and more successful users). In psych-speak, this phenomenon is known as “downward social comparison,” or the act of seeking out context that makes your own circumstances seem a little bit brighter.

“If you need a self-esteem boost, you’re going to look at people worse off than you,” study co-author Silvia Knoblock-Westerwick, a professor of communications at the Ohio State University, explained in a press release. “You’re probably not going to be looking at all the people who just got a great new job or just got married.” It’s the same reason why the unlucky-in-love are drawn to songs about people with romantic struggles of their own, as Knobloch found in a previous study—the reminder that it could be worse, that weird hybrid of schadenfreude and gratitude. You may not be doing great, but at least you’re not the guy whose problems are currently blasting through your speakers or filling your screen.

Of course, it’s a little easier to get your dose of gloom-and-doom via your iPod, when you’re the only one in charge, than on Facebook, where mysterious algorithms control what comes up—but for those looking to get the maximum self-esteem bump for minimal effort, here’s a tool that deletes all those adorable baby pictures from your News Feed. Happy scrolling.