Major themes in Holes include the consequence of choices resulting from fate and destiny and the importance of friendship. Sachar never sets out to teach a specific moral or lesson when he writes. Instead, he creates characters that his readers can empathize with and involves them in plots that are fun to read. As a result, he believes his readers will naturally become better people.
Throughout the novel, fate, which is a power or force that is thought to decide future events, is a major theme. Stanley and his father have always had bad luck. They are sure their bad luck can be attributed to the curse that Madame Zeroni put on Stanley's great-great-grandfather and future generations of Yelnats after he broke his promise to her. Stanley and his father expect to have bad luck. When Clyde Livingston's sneakers "fell from the sky," Stanley was sure the sneakers were a "sign." He thought they were "like a gift from God" and might be the "key to his father's invention." Stanley believes he is "holding destiny's shoes."
Even though Stanley is arrested, the consequence of his choice to run home with the sneakers is determined by fate. Stanley is wrongly accused of stealing Clyde Livingston's sneakers and chooses to go to Camp Green Lake instead of jail. He finds a lipstick tube while digging his hole in the desert at Camp Green Lake and figures out that it belonged to Kissin' Kate Barlow, who just happened to have robbed his great-grandfather as he traveled West on a stagecoach with the fortune he'd made on the stock market. He was stranded in the Texas desert. Green Lake dried up and the community ceased to exist after a drought cursed Green Lake (Green Lake was cursed after Sam the Onion Man was killed and Katherine Barlow's school was destroyed). Stanley's great-grandfather survived finding "refuge on God's thumb." Nobody ever understood what he meant until Stanley sees a mountain in the distance while he is digging a hole, which resembles a fist and a thumb.
Stanley is later accused of taking Mr. Sir's sunflower seeds and ends up in the Warden's cabin. He gets her makeup case from another room, and, as fate would have it, it is just like his mother's. Unbeknownst to Stanley, the Warden bears a close resemblance to Trout Walker's wife. (Trout walker and his wife went to the cabin the Warden is living in, years ago, intending to torture Kissin' Kate Barlow — who was living in the cabin — until she told him where she'd buried her "treasure.")
It is fate that brings Stanley and Zero (whose name is Hector Zeroni) to the base of the mountain that looks like a fist and a thumb. Because Zero is too sick to climb the mountain, Stanley carries him to the top. Once there, Stanley finds water and sings the lullaby that had been in his family for several generations — the same lullaby that his great-great-grandfather was supposed to have sung to Madame Zeroni after carrying her to the top of the mountain in Latvia.
Stanley and Zero return to Camp Green Lake and find the buried "treasure" — an old suitcase — and again, fate steps in. The suitcase has the name "Stanley Yelnats" on it, so he gets to keep it, and the yellow-spotted lizards won't bite them because they have been eating onions and yellow-spotted lizards don't like "onion blood."
Fate intervenes when Stanley's lawyer, Ms. Morengo, arrives at Camp Green Lake at the perfect moment. Stanley is innocent and, because the Warden destroyed Zero's files, he can leave also. Stanley has reached his destiny. He fulfilled his great-great-grandfather's promise to Madame Zeroni and the family believes the curse has been lifted.
Friendship is another major theme in Holes. Before Stanley goes to Camp Green Lake, he doesn't have any friends. He is overweight and is larger than his classmates. As a consequence, he is picked on and teased. Stanley is a misfit and he knows it. Between his low self-esteem and bad luck, Stanley is quite unhappy. After being at Camp Green Lake for a few weeks, Stanley realizes he is larger than the boys in his tent, but he is no longer fat — the shoveling has strengthened his muscles. The boys respect his size and give him the nickname "Caveman." A bond develops between Stanley and the boys. He gives X-Ray the lipstick tube he finds and takes the blame for Magnet when he stole Mr. Sir's sunflower seeds. Stanley understands the hierarchy that exists amongst the boys; consequently, they learn to trust Stanley.
Stanley and Zero form a close friendship. Zero trusts Stanley enough to reveal that he can not read or write. Stanley doesn't laugh at him. Instead he begins to teach Zero how to read and realizes that Zero is quite intelligent. Zero fights for Stanley and after he runs away, Stanley worries about him until he realizes his only choice is to go find him. Stanley's yearning to rescue Zero empowers him to carry Zero up the side of the mountain. Sitting on top of the mountain, Stanley is happy. He likes the person he has become and he feels good because he has a friend.
Another theme that is evident in the novel is family relationships — Stanley has a loving family and Zero has no family. Racism is evident when Sam the Onion Man and Katherine Barlow are punished because they have an interracial relationship and when Zero is called Stanley's "slave" by the other boys when he digs half of Stanley's hole. The influence of the environment on the actions of people is evident when the extreme heat and lack of shade anywhere makes the boys' "blood boil." Finally, a theme that Sachar revisits in other books is evident. That theme is the compassion for society's underdogs. Stanley and Zero are misfits, but when given the opportunity to prove themselves, they exhibit their strengths and rise above the negative judgments others make about them.