Jeffrey Lionel Magee loses his parents in a trolley accident in Bridgeport, Pennsylvania, when he is 3. He is sent to Holidaysburg to be raised by his aunt and uncle, whose coldness toward one another leave Jeffrey aching for the warmth of a real home. At 11, Jeffrey runs away.
A year later, Jeffrey arrives at Two Mills, a town where white people and black people are segregated. Jeffrey meets Amanda Beale, a young black girl who brings her collection of books to school so her younger siblings won’t color on the pages. Amanda begrudgingly allows Jeffrey to borrow one of her books. From there, Jeffrey runs — literally — into a series of situations where he accomplishes surprising feats of athleticism and bravery that quickly make him a playground legend among the children in town, who refer to him as Maniac.
One such feat is hitting every ball pitched by John McNab, the biggest and scariest kid in West End (the white side of town). Angry at being bested by the new kid, John rounds up a few boys and chases Jeffrey, with the intent of beating him up. Jeffrey runs all the way to East End (the black side of town), where John's group won’t follow him.
Remembering that Amanda Beale lives in East End, Jeffrey looks for her house. He carries the book he borrowed from her wherever he goes. Instead of finding Amanda, he finds Mars Bar Thompson, the biggest and scariest kid in East End (with an affinity for candy bars). The two almost fight after Mars tries to take the book Amanda gave to Jeffrey and tears one of the pages.
The woman who lives in the nearest house intervenes and sends Mars off. Jeffrey wanders through East Side, still looking for Amanda's house. Mars Bar and his friends follow him and corner him in an alley. This time it’s Amanda who intervenes. She kicks at Mars’ new sneakers until he runs away. Amanda brings Jeffrey to her house after he assures her that the torn page from her book can be fixed.
Once Mr. and Mrs. Beale realize that Jeffrey has no home of his own, they invite Jeffrey to stay with them. Jeffrey quickly becomes like another son to the Beales. He happily helps out with household chores and watches over Amanda’s two younger siblings, Hester and Lester.
The younger kids stop misbehaving under Jeffrey’s watch. The Beales take Jeffrey to church, feed him (they learn he is allergic to pizza), clothe him (he loves his new running shoes) and discipline him when he swears in the house.
Meanwhile, his fame grows among neighborhood kids. He can best even the high school boys at almost any sport, and he can untie even the most complicated knots in the little kids’ shoe laces and yo-yo strings. While many are excited to have Jeffrey and his talents with them in East End, others, young and old, do not think Jeffrey belongs there because of his skin color.
At a block party, an older black man demands that Jeffrey go back to the white side of town. The next day, the Beales’ house is defaced with racist graffiti. Jeffrey, worried that his presence might bring harm to his new family, is ready to leave, but Amanda comes up with an idea that might win the town’s favor.
The store on the corner between the West and East Ends of Two Mills has offered a prize of free pizza for a year to the person who can untie Cobble’s Knot, an enormous and complicated tangle of flagpole rope. Amanda is convinced that if Jeffrey unties the knot — something the residents of Two Mills have been trying to do for years — he’ll become the town hero and the hate will stop.
Jeffrey spends an entire day unravelling the knot, during which a crowd of all ages and skin tones gather to watch him work. The whole town celebrates his success, but during the commotion, someone breaks into the Beales’ house and tears apart one of Amanda’s favorite books. Again Jeffrey realizes that his presence in the Beale home will only bring them trouble, so he runs away.
For some time, Jeffrey is on his own again, spending his nights in the buffalo pen at the zoo. One day he stumbles back to the buffalo pen exhausted and battered from a fight with some kids. He is found by the old groundskeeper, Grayson, who feeds Jeffrey and converts a storage shed into a home for him.
For several months, Jeffrey helps Grayson with odd jobs around the zoo while they talk and, later, play baseball, since Grayson used to be a pitcher in the minor leagues. Grayson tries to convince Jeffrey to attend public school, but Jeffrey insists that the books he buys at library book sales are education enough.
When Grayson admits that he never learned to read, Jeffrey teaches him. They celebrate Thanksgiving and Christmas together, where they thank God for what little they have and are grateful for each other.
Before New Year’s, Grayson abruptly dies in his sleep. With everyone he’s ever been close to — his parents, his aunt and uncle, the Beales, and now Grayson — are either hurt or die, Jeffrey is convinced that he is toxic to people and spends the next month wandering from town to town, cold, despondent and alone.
At his lowest point, Jeffrey hunkers down in one of the model cabins at Valley Forge and waits for hypothermia to kill him. After a day and two nights, Jeffrey meets a pair of young brothers who are set on running away to Mexico, equipped with nothing but a bag of stolen candy. Knowing that someone must be missing them, Jeffrey bribes the two boys, Russell and Piper, to return to town with him for free pizza from Cobble’s Corner Store.
On the way, they run into John McNab, who turns out to be Russell and Piper’s older brother. Although John is still angry that Jeffrey embarrassed him on the pitcher’s mound, Jeffrey lies to the younger boys and tells them that John struck him out the next day. With amends made, the McNab children invite Jeffrey to stay at their house.
The McNab home is full of trash, animal droppings and animals — both dead and alive. The windows are boarded up and there is a hole in the second floor that Russell and Piper enjoy jumping through. Mr. McNab is normally intoxicated and doesn’t mind when his children or their friends drink the beers in the fridge. The boys and their friends are rowdy, playing football in the house and staging pretend gunfights.
Jeffrey stays with the McNabs out of concern and for Russell and Piper. He bribes them to attend school with free pizza and later with various playground dares. One of their dares is for Jeffrey to go to East End, which Jeffrey does without fear.
Jeffrey runs into Mars Bar again, who challenges him to a race to decide who is really the toughest kid in town. Jeffrey wins, running backward. Amid the crowd of kids who come to see the race are Hester and Lester Beale, who convince Jeffrey to spend one night at their home. Though Jeffrey is overjoyed to be welcomed back, he leaves early the following morning to meet back up with Russell and Piper.
While he’s been away, the McNabs have begun constructing a fort out of cinderblocks in the living room, in preparation for the day Mr. McNab fears: when the black residents of East End overrun West End. Russell and Piper see their father’s paranoia as a game, where whites are the good guys and blacks are the bad guys.
Unsettled by the open racism in the McNab home, Jeffrey goes for a run to clear his head. He has dinner with the Pickwells, a large family in West End who are always willing to set another plate of food at the table for someone in need. Spending time with them and seeing their generosity, Jeffrey is encouraged to try again to bring some goodness into Russell and Piper’s lives.
Over the next few weeks, Jeffrey tries to guide the two boys, but their troublemaking and disobedience wear on him. One day, when Russell and Piper are pretending to shoot black people, Jeffrey loses his temper and breaks their toy guns. He then takes his few personal possessions and leaves.
A few days later, trying to make amends, the brothers invite Jeffrey to Piper’s birthday party. Jeffrey agrees, on the condition that he can bring a guest. He surprises everyone by bringing Mars Bar — convinced that Piper and Russell would see things differently if they could just meet a black person.
Mars Bar had agreed to come on a dare, to prove that he is tough enough to go to West End. Mars Bar and Jeffrey visit the Pickwells before going to the party. Though Piper’s party ends in near disaster, the day forms an unspoken bond between Jeffrey and Mars Bar.
Over the next few months, where Jeffrey spends his days at the library or playing pickup games and his nights sleeping outside, Mars Bar gradually becomes Jeffrey’s morning running mate. Out on one of their runs, they are interrupted by a muddy and hysterical Piper McNab. Piper explains that he and Russell had been playing a game on the trolley tracks. Russell was now paralyzed with fear on the tracks while the trolley honked at him to move. Piper begs Jeffrey to help, but Jeffrey is also afraid. This was the very same trolley terminal where his parents were killed, the one place he has never dared to go. Jeffrey leaves without a word.
Ultimately Mars Bar gets Russell off the tracks and takes the two boys to his own home. His mother calms them down. After spending a day with the Thompsons, Russell and Piper invite Mars Bar to their own home.
Mars Bar explains all this to Jeffrey a few days later, after finding Jeffrey in the zoo. Mars Bar invites Jeffrey to stay with his family, but Jeffrey, afraid of hurting anyone else, says no. Mars Bar returns later that night with Amanda Beale, who refuses to allow Jeffrey to sleep with the buffalo. The three walk home together.