It doesn’t take a neuroscientist to know that doing nice things for people feels good. But now, researchers say they’ve discovered that even thinking about doing something generous has real mood-boosting benefits in the brain.

In a new study published in Nature Communications, researchers from the University of Zurich in Switzerland told 50 people they’d be receiving about $100 over a few weeks. Half of the people were asked to commit to spending that money on themselves, and half were asked to spend it on someone they knew.

The researchers wanted to see whether simply pledging to being generous was enough to make people happier. So before doling out any money, they brought everyone into the lab and asked them to think about a friend they’d like to give a gift to and how much they would hypothetically spend. They then performed functional MRI scans to measure activity in three regions of the brain associated with social behavior, generosity, happiness and decision-making.

Their choices—and their brain activity—seemed to depend on how they had pledged to spend the money earlier. Those who had agreed to spend money on other people tended to make more generous decisions throughout the experiment, compared to those who had agreed to spend on themselves. They also had more interaction between the parts of the brain associated with altruism and happiness, and they reported higher levels of happiness after the experiment was over.

Get our Health Newsletter. Sign up to receive the latest health and science news, plus answers to wellness questions and expert tips. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Another piece of good news was that it didn’t seem to matter how generous people were. Planning to give away just a little bit of money had the same effects on happiness as giving away a lot. “At least in our study, the amount spent did not matter,” said lead author Philippe Tobler, associate professor of neuroeconomics and social neuroscience, in an email. “It is worth keeping in mind that even little things have a beneficial effect—like bringing coffee to one’s office mates in the morning.”

It’s not yet clear how long these warm and fuzzy feelings last after being generous. But other research suggests that making generosity a regular habit may influence long-term wellbeing and happiness, the study authors say.

MORE: Here’s An Easy Way To Become More Patient

Studies have shown that older people who are generous tend to have better health, says Tobler, and other research has indicated that spending money on others can be as effective at lowering blood pressure as medication or exercise. “Moreover, there is a positive association between helping others and life expectancy,” he adds, “perhaps because helping others reduces stress.”

The researchers wonder, however, whether the feel-good effect of generosity could be dampened by deliberate attempts to take advantage of it—in other words, by expecting personal gains from performing selfless acts.

Still, the new study suggests that making a pledge to do generous things could be a useful way to reinforce altruistic behavior and even make people happier, says Tobler.

“It is known that actually helping others and being generous to them increases happiness,” he says. “I would still consider that the primary route to boost happiness; however, making a commitment to help others is a first step to follow through.”

Next time you think that the best way to make yourself feel better is to buy yourself a treat, consider that the opposite is likely true. “It is worth giving it a shot, even if you think it would not work,” Tobler says. “In order to reap health benefits, repeated practice is probably needed so that giving becomes second nature.”

Contact us at letters@time.com.