Jessica Pettway for TIME

It might seem intuitive that spending time outside is good for you. Whether it’s taking a walk to clear your head or smelling flowers in a backyard garden, getting outside is a dependable way to feel better.

The effect is real, and over the years, scientists have shown that nature can provide stress relief, increase social interaction, encourage physical exercise and even help soothe mental illness.

But this effect isn’t limited to forests or beaches that may be miles away. Growing research suggests that just about any kind of green space—from hiking trails and coastlines to soccer fields and local parks—can make you happier and boost your mental health, as long as it has a few key qualities.

Make your wellbeing a priority and sign up for TIME’s guide to self-care.

When it comes to seeking happiness, the quality of the green space matters more than the quantity. In one study in the journal BMC Public Health, researchers found no significant link between the amount of green space in an individual’s local area and their mental wellbeing. Merely having vegetation doesn’t guarantee a positive experience, explains study author Victoria Houlden, a PhD candidate at the University of Warwick in England.

While Houlden’s study used census units to measure how much green space people had access to, individuals don’t stick to government-assigned districts in real life. They may frequent a park near their office or go out of their way to play sports in a neighboring town. “The relationship between green space and mental wellbeing is more complicated than an arbitrary sense of boundary,” Houlden says.

In another study, a group of researchers in the Netherlands found that people who think of their local green spaces as more accessible and usable felt more satisfied with their neighborhood, regardless of the amount of green space they had. Neighborhood satisfaction was associated with happiness, the researchers said, and a previous study looking at the same neighborhoods that found residents reported better mental health and more emotional attachment to local greenery when they had higher quality green spaces.

So what makes a green space high quality (and therefore healthful)? Some research has linked specific types of green spaces—broadleaf woods, parks that feature water and areas with significant biodiversity, for example—to good health. If you’re looking to be awed by nature’s beauty, those aesthetic factors can be important.

MORE: The Healing Power Of Nature

But that’s not all. Dr. Andrew Lee, a public health researcher at the University of Sheffield in England, who has conducted large reviews of green-space research, says the functionality of parks is paramount for making people feel happy. “If it’s a social space, where people meet together and chat and go on walks, that kind of social contact and interaction builds social networks,” Lee says. “That’s probably where the real impact is coming from that gives people a sense of wellbeing.”

Parks without those features do the opposite. If a green space is difficult to get to, has poor lighting or is not clean, it may be seen as unsafe or inaccessible and probably wouldn’t boost a visitor’s mood, explains Lee.

People may also experience the benefits of green spaces in unique ways. Lots of research assumes that humans have an evolutionary connection to nature or that people enjoy green spaces because they remind them of childhood experiences, says Sarah Bell, a research fellow at the University of Exeter’s European Centre for Environment and Human Health. But that expectation can feel exclusionary to low-income communities or disabled people who may not have had access to nature growing up, says Bell.

MORE: Here’s How To Be Less Tired After Work

“It doesn’t necessarily come naturally to people,” Bell says of nature appreciation. “But even if you haven’t had childhood experience, life transitions can make these settings become quite meaningful.” Life transitions, like sudden health changes, the end of a job or something that causes a high level of stress, can make nature more important to people, she says.

The secret to using nature as a mood booster in these situations, Bell says, is to find activities in a green space that match the outcome you want. For some people, that may be going to a quiet park to escape their daily routine, while others use nature to challenge themselves and might prefer something strenuous like mountain biking or surfing. Still others may find comfort in nature when they interact with animals or other people.

If you know what you want to get out of your visit, any welcoming green space can help.

More Must-Reads from TIME

Write to Abigail Abrams at