You might have already guessed this, but science has confirmed it: Hugs are good for you.

Hugs and other forms of physical touch can help with physical and mental health in people of all ages, according to a new review of 212 previous studies.

By combining the findings of all these studies, the research team – from Ruhr University Bochum in Germany and the Netherlands Institute for Neuroscience – was able to get a broader picture of how touch might be beneficial.

"We were aware of the importance of touch as a health intervention, but despite many studies, it remained unclear how to use it optimally, what effects can be expected specifically, and what the influencing factors are," says neuroscientist Julian Packheiser from Ruhr University Bochum.

This new piece of research, covering 12,966 participants across all of the various studies, provided some clarity. Touch was shown to help reduce feelings of pain, depression, and anxiety, and the positive effect was observed in both children and adults.

While the type of touch (from hugs to massages) doesn't seem to matter too much, touching on the head or face appears to work best. Shorter and more frequent touches get more positive reactions, the study suggests.

Interestingly, touches from inanimate objects – weighted blankets, body pillows, or even robots – can help in terms of physical health, but they're not so good for mental health. Touches from humans and animals tend to be beneficial both physically and mentally.

Newborns benefit from touch too, but the positive influence is significantly greater when the touch comes from a parent, the research found. As we get older, whether or not the touch is from someone we know well becomes less important.

"The study clearly shows that touch can indeed be optimized, but the most important factors are not necessarily those we suspect," says neuroscientist Christian Keysers from the Netherlands Institute for Neuroscience.

Of course, while a large meta-analysis like this helps spot larger patterns across populations, responses to touch still vary a lot from person to person. The researchers also emphasize that touch needs to be consensual for it to be beneficial.

For many of us though, spending more time in physical contact with others can bolster many aspects of our health, the data shows – perhaps no surprise considering touch is the first of our senses to develop, and something we usually miss when it's not there.

"If you feel like hugging family or friends – don't hold back, as long as the other person gives their consent," says Packheiser.

The research has been published in Nature Human Behaviour.