Sad city dwellers should seek solace in a local park, according to a survey tracking tweets that showed a leafy walk lifts morale as much as Christmas among Twitter users.
Trees in cities are already credited with cooling and cleaning the air, along with absorbing planet-warming gases - but a team or researchers from the University of Vermont, in the United States, found they also cause happiness.
"Visiting parks leads people to being happier," the survey's lead researcher, Aaron Schwartz, told the Thomson Reuters Foundation by phone.
The authors scanned thousands of Twitter messages posted by more than 4,600 people from 160 parks and other leafy areas, like squares and playgrounds, in San Francisco between May and August 2016 for words indicating glee and elation.
Posts were then compared with messages the same users sent out before and after the green stroll.
They found that, on average, people used happier words and expressed less negativity while visiting a park and for up to four hours afterwards.
The greener and bigger the park, the happier the tweets, the researchers said in the first-of-its-kind survey published in the journal People and Nature.
The analysis was based on an online tool known as hedonometer, which ranks more than 10,000 common English terms on a scale from one to nine based on their happiness value.
"Laughter" is the happiest word on the scale, with a score of 8.5, followed by "happiness" and "love", while "trapped," "kill" and "jail" rank towards the bottom.
Overall, tweets sent from under a tree were 2.5% happier than the average, a jump that although numerically small, Schwartz described as "pretty big."
"(It) is about the equivalent increase that Twitter as a whole experiences on Christmas day," he said.
The holiday was the happiest day of the year on the social media platform, according to earlier research based on the hedonometer, which collects about 50 million tweets each day and scores those written in English, he explained.
Although not everybody uses Twitter, the platform's demographic is quite wide and analysis based on it could provide valuable insights into the moods of a large group of people, the researchers said.
With the United Nations estimating two-thirds of the world's population will live in cities by 2050, the survey's findings had important implications for city planners and health officials, they added.
From Montreal to Barcelona many cities are already looking at trees as a way to tackle climate change and pollution, said Donna Hume, head of campaigns at the C40 cities network.
"With so many people in the world's biggest cities suffering from ever hotter streets and polluted air, mayors are turning to trees and re-wilding to create havens for people that help our planet breathe as well," she said.
Schwartz said he hoped the research would provide them with extra incentives to go green and information on what type of green to prioritize, as results suggested large, lush parks were the most beneficial for mental health.
"Though this is a Twitter study, and therefore comes with inherent bias ... it nevertheless shows a positive trend that we have long suspected: contact with nature can make you happier," said Marcus Collie, an botany expert at Trinity College Dublin.
"If you can 'prescribe' a visit to nature, and this is happening on a daily basis, you can achieve a lot of health benefits at practically no personal cost. Plus you dog and your kids will thank you!" he said.