(CNN) Tom Hanks is taking getting into character to a whole new level. He's actually related to one.

Hanks just found out Sunday that he's related to Fred Rogers, who played Mister Rogers on the children's TV show.

The two are sixth cousins, Ancestry.com discovered. "It all just comes together, you see," Hanks told Access Hollywood when the show informed him of the relation.

Here's why it's especially notable: Hanks is playing Mister Rogers in the upcoming film , "A Beautiful Day in the Neighborhood." He says he didn't know they were related when he took the role.

Ancestry figured out the two are sixth cousins, and their common ancestor was Johannes Meffert. Their subsequent ancestors had the last name of Mefford.

Read More