This prison doesn’t have walls or guards, but no one wants to escape. The prisoners have been digging holes in the middle of the desert for many years. This story takes us to the desert, where a group of teenagers in prisoner uniforms is digging holes under the scorching sun.
A boy named Barfbag can't stand the hard work and gets bit by a rattlesnake on the leg to free himself from hard labor. At the same time, somewhere in town, a pair of sneakers falls on the head of a boy named Stanley Yelnats, knocking him off his feet. The boy's family is in the process of inventing a remedy for stinky feet, so he decides to bring the smelly shoes home.
On the way, the police arrest him and accuse him of stealing a famous baseball player’s sneakers from a charity event. The policemen bring the boy to his parents and are surprised to find that a variety of pairs of shoes occupy every corner of the apartment. The cops leave the apartment, convinced that the boy is just a shoe freak and that he is the one who stole the celebrity's sneakers.
The oddball family believes that there is an ancient family curse on all the men of the Stanley Yelnats family, and that's why Stanley Jr. has had another unfortunate event happen to him. By court order, Stanley is sent to a detention camp called Camp Green Lake, where he must spend 18 months in hard labor.
The camp is located in the desert in a small oasis where, despite the name, there is no lake. At the camp, Stanley meets the warden, who orders him to call him Mr Sir. He immediately warns the boy that there is no point in escaping from the camp - for hundreds of miles, there is only desert without a single body of water.
Attempts to escape will only end with death from the bite of venomous reptiles and the claws of predators. Stanley is given a prisoner uniform and a shovel and is told of his duties. Every day, he will have to dig holes in the desert from dawn to dusk.
A correctional camp psychologist nicknamed Mother introduces Stanley to the other boys in the squad he has been assigned. The teens respond only to their nicknames—X-Ray, Armpit, Squid, Zigzag, Magnet, and Zero. Zero is the smallest of the teens and got his nickname because he is constantly silent, meaning he only has zeros in his head.
Stanley joins the squad in place of Barfbag, who had gotten bit by a rattlesnake earlier, so the boys first treat him with disdain. At lunch, Stanley talks about what got him into the camp for troubled teens. He was unfairly accused of stealing baseball player Clyde Livingston’s sneakers, which he donated to an orphanage.
Hearing the boy's story, Zero breaks the silence for the first time and asks Stanley if the sneakers had red crosses on them, and the boy surprisingly confirms his hunch. At night, Stanley recalls his father's stories about their great-grandfather, Stanley Yelnats the First. He is the one who started their family curse.
He had made a fortune in the stock market in the past, but he was ripped off by a woman nicknamed Kissing Kate Barlow. Once upon a time, the woman and other outlaws operated in the Wild West, and she was known for kissing her victims before they died, leaving a trail of bright lipstick on their faces. Stanley Ylnats the First worked as a pig farmer in a Latvian village and fell in love with a gorgeous girl – his owner’s daughter.
Stanley decided to seek advice from the local fortuneteller, Madame Zeroni, so she could tell him how to win the girl's heart. The woman advised him to forget about the silly girl and go to America, where destiny awaited the boy. Stanley, in love, didn't listen to the fortune-teller and went to the girl's father to ask for her hand and heart but was refused.
Then Stanley goes back to the fortune teller. To placate the girl's father, the fortuneteller advised the boy to take a little piglet and carry it up the mountain daily to drink from the stream. Then the pig would become bigger and bigger and could be given to the father in exchange for his blessing.
Stanley did as he was told and returned with the gift to his beloved's house after some time. But, as the fortune-teller had said, the girl was very foolish. She could not choose between the handsome Stanley and some ugly man who also gave her a pig.
Disappointed by the girl's stupidity, Stanley decides to follow the fortune teller's first advice - and sets off for America, where a new life awaits him. But the hapless fellow completely forgets the promise he made to the woman. He was to take Madame Zeroni to the same mountain and give her a drink from the stream so that she, too, would gain strength and youth.
Because the boy did not comply with the fortuneteller's requirement, the fortuneteller cursed his entire male lineage forever. After working in the camp for a few days, Stanley gets used to the local rules and hard work. He notices that none of the boys know what they are digging the holes for.
Stanley writes a letter to his parents, in which he lies that he is fine at camp so that his family won't worry. On another day of digging, Stanley finds a fossil and gives it to "Mother," hoping he will be given time off for his find. But the psychologist assures him that the warden doesn't care about any fossils.
He also tells him there used to be a lake on this land, and all the land around it belonged to the warden’s grandfather. The story takes us back a hundred years to when the warden's grandfather ruled the town. A man named Sam sells miracle onions, which he says cure all diseases and scare away poisonous lizards.
Sam has a crush on the local teacher, Miss Katherine, so he gives her a sack of onions. In return, she gives him a jar of peaches she picked herself. All the men in town are secretly in love with the beautiful teacher, so they watch the couple with envy.
Stanley is approached by X-Ray and told that the next time he finds anything, to bring it to him. The boys finally accept Stanley into the group and give him the nickname Caveman. Reading a return letter from his mother, Stanley laughs at her stories.
Zero asks him what he is laughing at and then admits that he can't read. Zero asks Stanley to teach him to read, but he says he is exhausted every day from digging and has no time for it. At the dig site, Stanley finds something that resembles a shell casing with the initials "K.
B. " It is picked up by X-Ray and given to Mother the next morning to get the day off. Upon hearing about the find, the camp warden, who turns out to be a woman, arrives at the camp.
She gives X-Ray the day off and orders the rest of them to completely dig up the entire site. The story moves back in time again, where Sam offers Catherine to fix the leaky roof at her school in exchange for her signature peaches. Catherine agrees, and so the couple slowly begins to bond.
After a night school class, Catherine begins to be courted by the town’s owner but receives a firm rejection. Romantic feelings flare up between Sam and Catherine. Although the repair work is finished, the couple can not stop thinking about each other.
One night, Sam musters up the courage to go to Catherine's house and kiss her. The spurned town owner sees this and decides to get revenge by burning the school to the ground. In despair, Catherine runs to the local sheriff for help, but he only taunts the girl, saying that her lover will soon be executed.
Sam is shot in his boat right in front of Catherine. After some time, the girl goes to the sheriff again to avenge her lover's death. She kills the man and pays him with a kiss on the cheek.
From then on, her journey as an outlaw under the pseudonym Kissing Kate begins. The granddaughter of the town owner has adopted her grandfather's lousy temper and makes teenagers dig day and night to find Kate’s treasure. Mr Sir brings water to the dig site and distributes it to the boys.
While the warden is out of sight, a boy named Magnet steals a bag of seeds from his truck. Mr Sir quickly notices the loss and goes back to the dig site. In a panic, everyone starts throwing the bag of seeds back and forth, and it spills at Stanley's feet.
Despite the precarious situation, Stanley does not give away any of the squad and takes the blame. Mr Sir takes the boy to the warden to punish him for the theft. But instead of the expected punishment, the warden scolds the warden for distracting the boy from his digging.
Before returning to the desert, Stanley notices posters in the warden's office showing the search for Kissing Kate. When Stanley returns to the dig, the guys consider him a hero, and Zero digs a hole for him. In gratitude, he offers to teach Zero to read and write.
Remembering his previous find, Stanley guesses that what he found in the hole earlier was not a bullet casing but a tube of lipstick with Kate Barlow's initials and shares his discovery with Zero. During their talk, Zero reveals his real name, Hector Zeroni. It turns out that the boy is related to Madame Zeroni, who cursed the Stanley family years ago.
But the boys have no idea that their fates are closely linked and continue to bond. Zero tells his friend a story about his mother, who left him alone in the park and disappeared. During their lunch break, Zigzag clutches up with Stanley.
The warden arrives at the dig and learns from the boys that Zero is doing some of Stanley's work in exchange for teaching him to read. Stanley tries to convince the adults that the boy is brilliant and should be tutored, to which Mother laughs wryly. He tells Zero that he is so stupid that he does not realize he is stupid.
Zero decides that he has had enough and hits Mother in the face with a shovel, running off into the depths of the desert. Upset over his friend's escape, Stanley recalls his grandfather's stories of how Yelnats First survived 16 days in the desert after Kate Barlow robbed his wagon. He found his salvation in a place called God's Finger, but because of the stress he was under, he could never explain to anyone where it was.
The next day, Stanley decides to rescue his runaway friend. He steals a car from the warden, and after driving it briefly, it falls into one of the holes. Continuing on foot, he escapes deep into the desert while the rest of the squad cheers him on.
After hours of wandering through the desert in the blazing sun, Stanley finally finds Zero. The boy has been hiding under an old boat that once belonged to Sam. There's even a jar of peach jam left inside, which the boys share.
In the distance, Stanley notices a mountain that reminds the boys very much of a raised thumb. The boy realizes it is the mountain from Stanley’s grandpa's story about Yelnats the First. The boys decide to climb the mountain to find safety.
Climbing the rocks, Stanley grabs hold of a fragile rock ledge and slips away. Zero hands his friend a shovel so he can use it to climb up. This causes the boy to hurt his palms badly, but he saves Stanley from death.
Together, the boys almost reach the top, but because of fatigue, Zero falls and can't move any further. The boys take a break, and Hector confesses to his friend that he ended up at the camp because of him. Zero stole the same sneakers from his orphanage and threw them off the bridge right on Stanley, scared of being held responsible.
After his confession, the boy faints. Stanley holds no grudge against his friend and carries him on top of himself the rest of the way. Thus, unknowingly, he fulfills his great-grandfather's promise to Madame Zeroni by carrying her great-grandson to the creek at the top of the mountain.
The happy duo drinks from the creek and eats the same miraculous onion Sam grew right next to the water. Meanwhile, Stanley's father finally manages to find a workable cure for the unpleasant foot odor - combining peaches and onions together. The Stanley family's family curse is now lifted forever.
Stanley's lawyer arrives at the camp and tells the warden that the boy is innocent and must be returned home. However, the warden withholds that Stanley has already escaped from camp for days and may already be dead. We go back in time one last time.
There, Kate Barlow finds Sam's boat and sits down, remembering her previous lover. The woman is approached by the town’s owner, who tries to get her to tell him where she hid all of the stolen treasure. But Kate lets herself be bitten by a yellow-spotted lizard and takes the secret to her grave.
Since then, more than one generation of the owner has unsuccessfully dug through the former lake's land to find the treasure. In the morning, Stanley and Zero are the first to get to the excavation site and dig up the treasure chest in the spot where Stanley found the lipstick tube. The warden finds them, along with her accomplices, and plans to take the coveted treasure from the boys.
But her plans are thwarted by venomous lizards that have swarmed around the boys and the treasure chest. Later, a lawyer arrives at the excavation site along with the police. The warden accuses the boys of stealing the treasure and trying to escape, but Zero notices Stanley Yelnats’ name on the trunk.
Stanley is released from the camp along with the treasure, and the warden and her minions are detained. It rains in the desert for the first time in a hundred years. Stanley says goodbye to his happy crew and he and Zero head back to town.
At home, Stanley shares his great-grandfather's treasure between his family and Zero. Hector finally manages to find his mother, who has been looking for him all this time. The boys become neighbors and invite all the released camp kids to visit.