I believe it's implied that it wasn't a logical or conscious realization; it's a 'link' issue; being her family, she had a bond of some sort with them, and was able to realize that none of the proffered pigs were them.
Kind of consistent with a lot of moral stuff both in the movie and in the genre in general; if you notice, she didn't solve many problems in the movie with brainpower, so much as with 'heart', courage, or determination.
She was able to identify (or fail to, in this case) her parents because they were her parents, and there was a significant bond; had there not been one, she would have failed, and deserved to fail, as they weren't significantly a family.
(Slightly heavy-handed for a moral point, but it was a kids movie :) )
scifi.stackexchange.com/users/2292/K-H-W
According to Rocket News 24 , this is what Miyazaki himself answered a few years ago: “I’ve never explained why Chihiro knows that her parents are not among the group of pigs towards the end of the film.
Those people who are constantly seeking explanations often say that it’s illogical.
However, I don’t think those kinds of things are important.
After all the things she’s experienced up to that point, Chihiro simply knows that her parents aren’t there.
You ask why she knows, but knowing is human life.
That’s all it is.
If you can point out that something is lacking here or there, then the audience should fill in the gaps for themselves.
I don’t want to waste time thinking about those kinds of things.”
More recently, again from Rocket News 24 , a Studio Ghibli employeesaid that Chihiro could tell because she had obtained special abilities in the spirit world:
“Chihiro, as a 10-year-old girl, could understand the difference because she had overcome difficulties and had managed to acquire the ‘energy to live’ – which is something everyone can do naturally”.
scifi.stackexchange.com/users/30638/Oriol
methroach wrote : In fact, Haku told her to remember what they looked like.
She later dreamed that she would not be able to distinguish them from the other pigs.
But at the end, she was able to tell that they weren't part of the group she was shown because she grew up and gained confidence in herself during her adventures.
scifi.stackexchange.com/users/8573/Littm
She got told by Haku that if she forgot she wouldn't be able to help her parents and would get stuck in the world of spirits, so she always tried to remember what happened.
That's how she could tell.
scifi.stackexchange.com/users/17877/loui
I think in the earlier scene when Chihiro's parents first eat much at the restaurant, they have some kind of hairs left on their head.
Meanwhile, the pigs were chosen by Yubaba seem had no hair on their head.
But of course it's also a family bond I think
scifi.stackexchange.com/users/51551/Luksi
For me, Since haku told her to not forget who she is so she may include how her parents looked like ... And her parents weren't pigs in the first place so it's understandable that her parents are not one of those pigs
scifi.stackexchange.com/users/67311/Pathy
In Spirited Away, Chihiro is tested to identify her parents from a group of pigs. Chihiro answers that none of them are.  Good. But how did she come to that conclusion? Surely it made sense to say that none of them were her parents (they're pigs, after all ;D), but is there not a clue or any other hint about Chihiro's answer?
How could Chihiro tell that none of the pigs were her parents?
scifi.stackexchange.com
<spirited-away>
scifi.stackexchange.com/questions/24163
scifi.stackexchange.com/users/1660/Voldemort
She was able to identify (or fail to, in this case) her parents as there was a significant bond - this is a "link" issue. Had there not been one, she would have failed, and deserved to fail, as they weren't significantly a family. There is a significant bond with her parents which means she could innately tell.
There is a significant bond with her parents which means she could innately tell.