"A Tale of Two Stans" is the twelfth episode of the second season of the American animated television series Gravity Falls, created by Alex Hirsch. The episode was written by Josh Weinstein, Matt Chapman, and Hirsch, and directed by Sunil Hall.

Plot 
Stan tries to embrace his brother, who punches him in retaliation for reactivating the machine. As they begin to fight Mabel interrupts, and Stan reveals that their baby brother had kids, and the twin is happy to learn he has a nephew and niece, while Dipper is excited to meet the author. It is revealed that Grunkle Stan took his brother's name, to Ford's dismay. Stanford is outraged to find out the US government now knows about the portal. Stan has to reveal his past to Dipper and Mabel, along with the secrets of his twin brother, Stanford "Ford" Pines. 

Stan's real name is actually Stanley Pines: Both Stanley and Stanford were close in their youth being each other's only friend, and usually dreaming of sailing away when their older to have a life of adventure. However when in high school, Stanford made a machine which would get him into a good college which would be presented at the science fair, while Stanley was an underachiever who would be lucky to even graduate high school. Stanley and Stanford talk, saying that if his machine is liked, Stanford would move to his dream school across the country. In the night at school, Stanley accidentally breaks the machine and attempts to fix it, dropping a chip bag by it. This results in Stanford's college dreams going up in smoke, and Stanford gets outraged thinking Stanley sabotaged him on purpose after seeing Stanley's chip bag next to his ruined machine. This results in Stanley getting kicked out of the house and disowned by the twins' father due to their father being furious with Stanley for ruining Stanford's chances to attend his dream college and earn a lot of wealth, so Stanley furiously declares he'll make it big and make a lot of money. 

While Stanford would go to a less prestigious college where he would research the supernatural and befriend Fiddleford McGucket, Stanley would go from town to town under different names trying to sell products. This backfires so badly, people ran him out of town after town. After moving to Gravity Falls, Stanford discovered Bill and after being tricked into a deal with him, builds a portal. When McGucket sees what's inside and goes crazy and leaves, Stanford tries to prevent a great evil that he knows he's inadvertently unleashed. He calls Stanley to Gravity Falls so he'll take one of his journals and sail across the world to hide it. Stanley is outraged that Stanford doesn't want to reconcile, so Stanley attempts to burn the journals as an easier way to get rid of them, leading to a fight with Stanford, ending with Stanford getting sucked into the portal, which then breaks. 

Due to a misunderstanding, Stanley assumed his brother's identify as "Stanford Pines", faked his own death, and spent the next thirty years using Ford's house as a tourist attraction to earn money to buy parts to repair the portal. He was finally able to reactivate the portal after the kids discovered Ford's missing journals. In the end, the agents leave after having their memories erased by the memory gun, and Stanford decides to live in the underground lab under the Mystery Shack. Grunkle Stan makes him promise he will leave the kids alone after being told that he would have to leave the Mystery Shack at the end of the summer. Upon hearing this, Mabel becomes worried that she and Dipper will end up like them when they're older, but he doubts it.

In the mid-credit scene, Soos calls an exhausted Wendy in the night to explain what happened.

Broadcast and reception
This episode was viewed by 2.3 million viewers on Disney XD, a new record for the network.

References

Gravity Falls episodes
2015 American television episodes
Coming-of-age fiction
Fiction about memory erasure and alteration
Fiction with unreliable narrators
Identity theft in popular culture
Works about twin brothers
Television episodes set in the 1960s
Television episodes set in the 1970s
Television episodes set in the 1980s