Most people have an uncanny ability to tell one face from another, even though the differences are extremely small. Now scientists think they know how our brains do this.

In macaque monkeys, which share humans' skill with faces, groups of specialized neurons in the brain called face cells appeared to divide up the task of assessing a face, a team at the California Institute of Technology reports Thursday in the journal Cell.

"The cells were coding faces in a very simple way," says Doris Tsao, an author of the study and a professor of biology at Caltech. "Each neuron was coding a different aspect of the face."

The actual coding involves some complicated math. But the approach is a bit like having one cell measure a variable like the distance between a person's eyes while another cell looks at skin texture, Tsao says.

And the system is so efficient that the team was able to accurately reconstruct the face a monkey was seeing using the signals from just 205 neurons. When placed side by side, the pictures the monkey saw and the reconstructed images are "almost indistinguishable," Tsao says.

The finding helps explain primates' "exquisite ability to distinguish faces," says Ed Connor, a professor of neuroscience at Johns Hopkins University who was not involved in the study. "Neuroscience really gets exciting when it shows you physically what is happening that gives rise to an experience," he says.

The study is the result of nearly 15 years of research by Tsao and her team. They had previously shown that macaque monkeys, like people, have brains with six separate areas that specialize in processing faces.

Then they began trying to solve the mystery of how the cells in these brain areas tell us whether we're looking at our grandmother or a complete stranger. "The reason why this is such a big mystery is that, as we all know, it seems like there's an infinite number of possible faces," Tsao says.

Tsao thought the brain must be using some sort of code to represent each face it encounters. So her team studied two monkeys as they looked at pictures of human faces, focusing on the electrical activity of just 205 brain cells in two of the six brain areas that process faces.

Connor says the coding system Tsao discovered helps explain something that has puzzled him for a long time. "Matt Damon and Chris Pratt look very different to me," he says. "But I cannot tell you what it is that makes Matt Damon look like Matt Damon and Chris Pratt look like Chris Pratt."

Now Connor thinks he understands why. "The process of differentiating faces is so highly developed in the brain, it's invisible to us," he says.

The research also suggests the possibility of some mind-blowing applications, Connor says.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.