An amiable joke can be much more effective than darker humor at improving mood, according to recent research from Stanford University.

In the study, led by psychologist Andrea Samson and James Gross and published in February in Cognition & Emotion, 40 people in Switzerland and 37 people in the U.S. looked at photographs of upsetting things such as car accidents, corpses and dangerous animals. They were instructed to either say nothing about the images, use good-natured humor focusing on the absurdity of life or the human condition, or use mean-spirited humor. The experimenters offered examples of each type of response to help coach the subjects; given a picture of a snake with its prey, for instance, “Looks like someone's bitten off more than they can chew” exhibits positive humor, whereas “Nourishing my future handbag” has a negative spin.

In both countries, those who made benevolent jokes about the images had more positive emotions and fewer negative emotions afterward than those who laughed mockingly at the pictures, although both groups who used humor fared better than those who simply looked silently.

The upshot: when something upsets you, humor can help. The next time you try to laugh off a grim situation, reflect on whether your jokes skew negative (“My boss isn't just dumb; he has terrible body odor, too!”) or positive (“No matter what happens at work, I've got it better than a politician these days …”). You might find tweaking your comedic style could give more of a boost.