As a child, I often turned to my dog for comfort when I was feeling sad. Staring into her big brown eyes made me feel as if she understood me and truly cared.

Now, a new study suggests that wasn’t just in my head.

Researchers at the University of Vienna came up with an ingenious way to study how dogs respond to human (and dog) emotions. Their findings suggest that dogs can pick up on emotions in both species and even distinguish between positive and negative feelings, implying they might possess one of the key building blocks for empathy.

For the study, dog owners brought their dogs into the laboratory, where loudspeakers were set up in different locations around a room. The dogs were let off leash and given a blanket to lie on near where their owner was seated.

While the owners wore headphones and ignored their dogs by reading a book (so their reactions couldn’t influence the experiment), sounds were played over one of the loudspeakers at different intervals. The sounds included dogs engaged in playful barking or whining (positive and negative emotion), humans laughing or crying, sounds of inanimate objects (like rain falling or leaves rustling in the wind), and animate sounds devoid of emotional content (like the sounds of a cricket or a person engaged in non-emotional talk). The dogs’ reactions were videotaped for later analysis.

Video analyzers who didn’t know which sounds were being played looked for various signs that the dogs were paying attention to or approaching the loudspeakers. They also looked at behaviors that other research has associated with arousal or distress—such as barking, whining, yawning, or lip licking—and created a score based on the duration and intensity of the behavior.

Results showed that dogs paid closer attention to loudspeakers when they heard emotional content—either positive or negative emotions vocalized by a human or another dog—in comparison to non-emotional sounds. In addition, they had higher scores overall and on one behavior—freezing—when they heard negative emotional sounds compared to positive ones, indicating that they recognized the difference between distress and happiness.

“We were surprised by how the dogs responded” ―University of Veterinary Medicine Vienna researcher Annika Huber

This is the first study to show that dogs distinguish between positive and negative emotions in others.

“We were surprised by how the dogs responded to positive emotional sounds,” says study author Annika Huber. “They paid the same level of attention to them as to negative emotional sounds, but did not express negative emotion behaviors in the same way.”

Interestingly, the way dogs responded to negative emotion was identical whether the emotion was expressed by humans or by dogs—except for freezing, which was more evident for dog sounds than human sounds. The results suggest that emotional contagion occurs across species, perhaps unconsciously.

“Since dogs share their natural environment with us humans, our emotional vocalizations are likely to be of relevance to them,” says Huber. “It indicates our close relationship.”

While prior studies have found that dogs respond to humans in distress with comforting behaviors, it’s not clear whether these responses are triggered by a dog’s own feelings or are simply trained by prior experiences. Of course, that’s difficult to say for sure, since dogs cannot express their feelings verbally. But Huber’s research points to the possibility that dogs’ feelings do sometimes mirror our own.

“If dogs increasingly express behaviors indicating negative emotional states in response to negative emotional sounds, it’s reasonable to interpret this as being driven by emotional contagion,” says Huber.

Why should we care about this? Huber says that her research indicates dogs have more emotional capabilities than we may realize. This could have implications for situations in which dogs and humans interact, such as when they are used as therapy animals or simply live in a family as a pet.

“If dogs are affected just when hearing emotional vocalizations, we should become more aware of the emotional state of dogs in our everyday contact with them,” says Huber.

She also hopes her research may lead to more compassionate treatment of dogs in the future—and of other animals, as well.

“Insights on the emotional capabilities of non-human animals in general and dogs specifically are important to consider with regard to their welfare and their ability to suffer,” she says. “At least it should affect our ethical considerations of dogs.”