In a river of blue, Ky Markham and his friend Vick Roberts dispose of a dead body at the command of an Officer. They remove his jacket and Ky surprises Vick by reciting a piece of Lord Alfred Tennyson's poem "Crossing the Bar" over the body, which few people know in the literature-policing Society.
Far away in a work camp, Cassia Reyes is coming upon the end of a long, three-month work detail, after which she will be assigned a permanent data-sorting vocation in Central, the Society's biggest City. She and her cabinmates gather around to admire Cassia's copy of the painting Chasm of the Colorado before its weak paper disintegrates. When the mail arrives, Cassia is distressed to see that her best friend and Match, the person to whom the Society assigned her as a romantic life partner, Xander Carrow, has sent her nothing. However, an Official takes Cassia to the main hall, where Xander has come to visit in person.
Ky and his fellow recruits' job is to act as fake, decoy villagers in the abandoned, war-torn Outer Provinces of the Society. The Society uses these decoys to fool the enemy into thinking the villages there still thrive with citizens. Some of Ky's fellow recruits head up into the mountains to taste freshly fallen snow, as their water supply is limited. Ky stays behind and digs graves for the dead, thinking about the compass his adopted mother gave him, which he has since given to Cassia. An implied, undescribed firing on their location occurs. When it finishes, Vick comes and helps Ky dig. Ky hopes that the recruits who are now dead in the mountains at least got to taste the snow first.
Cassia and Xander share an emotional reunion and Cassia asks if they can visit the local Museum together. While there, Cassia finds an Archivist, a rebel within the Society willing to trade information. She asks for a map to the Outer Provinces in exchange for a fee. Later, while she and Xander enjoy time at the local Music Hall, she finds the map beneath her seat. Back at the work camp, Xander laments having lost Cassia's love, but she comforts him by revealing that she traded Ky's compass for the information, not the blue tablets meant to keep citizens alive, which Xander provided her in Matched. Xander hints that they'll see one another again.
Ky and Vick continue burying bodies. Vick asks about the Tennyson poem and Ky explains that he and Cassia bonded over it in Matched. When they break for lunch, Vick tells Ky that the blue Society tablets are not actually sustenance, but poison. They receive word that they're being transferred to a new location. When they arrive, they're joined by new recruits, including a very young boy named Eli. Out of earshot of the miniports that constantly listen to their conversations, Vick tells them that the ammunition is all blanks and to plant seeds like farmers and not bothering trying to defend themselves. Later, Vick and Ky discuss escaping into the canyons nearby, which are known as the Carving. Ky wants to take Eli too, as he reminds him of Cassia's younger brother, Bram.
Cassia is horrified to discover that the Archivist gave her not a map, but a story. It details a man who piloted a rock up a mountain every day until a flash flood washed him away and a young boy took over, saying that “the Pilot will always live and move” just beyond the Society’s borders (55). Cassia destroys the story. The next day, certain girls are taken from the work site. When one of the girls from Cassia's cabin is requested and not found, Cassia pretends to be her and boards the ship. The girl originally requested, named Indie, was missing because she attempted to run. She is caught and forced to board as well.
Ky gathers gunpowder which could potentially turn their guns into grenade-like weapons. He and Vick decide to escape that night.
On the airship, Indie agrees to hide Cassia's blue tablets while Cassia is strip-searched, and then Cassia hides an undisclosed possession of Indie's while she is searched as well. They land in the Outer Provinces and are given minimal gear to survive. Cassia feels hope in being closer to Ky.
Vick and Ky show the other recruits how to turn their guns into grenades. They receive a message that a new shipment of recruits is coming in shortly. Before it does, though, the enemy begins firing on the village, and Vick and Ky grab Eli and make a run for it. As they do, Ky flashes back to running toward the Carving when his village was bombed and his parents killed. The Society picked him up in a ship and gave him a red tablet to make him forget how his parents died, but it didn't work and Ky still remembers. In real time, the three run into one of the canyons.
Cassia does not see Ky when they disembark. She and the other female recruits are told they're there to die. Cassia wastes no time in finding a boy to ask about Ky. He tells her Ky is dead, but she refuses to believe him. Later, she bribes him with food and he tells her that Ky and the other two ran to the Carving. She and Indie plan to do the same, and convince the boy to come with them. That night, they run for miles until they reach the Carving. Indie and Cassia head into a different canyon than the boy, but not before Cassia gives him two blue tablets.
Ky, Vick, and Eli trek through the canyon. They discover that wired disks in their jackets are monitoring them. Ky and Vick cut theirs out, but Eli leaves his in. Ky reflects on discovering Cassia with the Tennyson poem in Matched, and how it was his first time realizing the the poem existed before the Rising (which is what they call the rebellion against the Society). He didn't tell Cassia about the poem's connection to it at the time.
Cassia and Indie search for Ky and/or signs of the Rising in their canyon. Indie finds an old wasp's nest and puts it in her bag. That night, Cassia tries to write a poem for Ky but manages only one line. Indie is surprised to learn that Cassia can write by hand, as the Society forbids it. They discuss how they became Aberrations. Cassia, unsure if she still retains citizenship status or not, answers vaguely, but Indie explains that her mother made a boat and tried to escape the Society. When she was caught, she and Indie were reclassified as Aberrations. Cassia manages to write a second line of her poem.
The three boys continue on, discussing how, when the Society was formed, many people who became known as Anomalies chose not to join it and moved to the Carving. The Society used their presence to scare people from going there, though the Anomalies were not truly dangerous. Ky's father used to trade with the Anomalies. The three come across an abandoned village. Ky carves Cassia's name into a tree. Above the settlement, they find a cave full of food, books, and even plastic boats. A map there shows them how to get out of the Carving. They sleep in the cave, and in the morning, Ky sees a light on in one of the village houses.
Cassia and Indie decide to search a different canyon. They carefully scale the canyon wall, Indie bloodying her leg in the process, and discover a sea of corpses at the top, streaked with lines of blue. Indie thinks they've been dead for more than a week.
As they leave the settlement behind, the boys discuss how the "Pilot" refers to the leader of the Rising. Ky's father used to visit the village port and hold meetings to discuss the rebellion, and it was during one such meeting that the firing occurred and they were all killed except for Ky, who had been up on a nearby plateau to watch the coming rain. They find a cave full of wall paintings, and Ky thinks back to when he was taken from the Oria Province at the end of Matched. He's afraid Cassia will forget about him now. Before sleeping, Vick reveals he took some pamphlets from the other cave. They detail elements of the Rising, including how the Tennyson poem was not approved for preservation when the Society was formed, and that the Rising now exists throughout the entire Society. Later, while the other two sleep, Ky carves a compass of stone, thinking of Cassia. He has a nightmare of Cassia reuniting romantically with Xander and Vick has to wake him up.
Cassia also has a dream about reuniting with Xander, and cries when she wakes. Thinking that she might be ill, she takes a blue tablet. In its foil container, she finds a piece of paper with information from the microcard about Xander that she received when they were Matched. Each tablet container harbors one. Feeling hopeful, Cassia goes for a walk, where she stumbles across the dead body of the boy with whom she and Indie escaped from the Outer Provinces. His lips are blue from the tablets Cassia gave him and he appears to have scratched at the artificial canyon wall beside them until his hands bled. Indie finds Cassia and urges her to keep moving. They climb back into the canyon from which they originally came.
The boys climb out of the canyon and catch fish in a nearby stream, which Vick often did back in his home province of Camas. They return to the canyon to cook the fish. Vick tells them his father was an Officer, and Eli says that his parents died of illness in Central, which Ky finds suspicious. When Eli goes to sleep, Vick tells Ky about an Anomaly named Laney with whom he shared a marriage contract - a defiant and illegal act in the Society. This was the reason for his reclassification to Aberration status. He tells Ky of a rainbow fish he found one day which he considered a sign that he should marry her. Ky carves her name into a piece of wood for him. They thank one another for supporting each other thus far.
Cassia is weakening as she and Indie walk, though she feels hopeful upon seeing Ky's carving of her name in a tree. They discover the same abandoned village as the boys. Indie is aghast when Cassia admits to having taken a blue tablet and tells her that they're poisonous. Cassia refuses to believe Xander would've given her poison. Farther beyond the settlement, Cassia believes she hears footsteps following them, but Indie thinks she's hallucinating. Cassia attempts to take another blue tablet, but drops it and the piece of paper concealed with it, too fatigued to retrieve them.
Ky and Eli wake to the sound of explosions. They climb out of the canyon and find Vick dead and the river destroyed. A dead rainbow fish lies in one of the pools of water created by the destruction. In desperation, Ky and Eli spend hours futilely removing toxin-spitting spheres from the water, and then bury Vick's body.
Cassia's condition is worsening as she and Indie walk. She finds Ky's stone compass and feels hopeful.
Eli wants Ky to say the Tennyson poem over Vick's grave, but in his grief, Ky refuses. They prepare to move beyond the canyon into the plain when they spot Cassia on the horizon. She points at the sky to signal that it's her. They take off running toward one another and share a passionate reunion kiss. Cassia wants Ky to say the words of Dylan Thomas' "Do Not Go Gentle Into that Good Night," a poem they consider "theirs," but he's too emotional. When they calm down, they introduce Eli and Indie to one another, and then all of them trek back into the canyon. They share stories of how they came to be there, including Vick's death that morning and Xander's blue tablets, which make Ky jealous. Later, when Eli and Indie sleep, Ky is able to say the poem's words to Cassia.
The next day, Ky and Eli show the girls the data collectors in their coats. Ky cuts Cassia's out, but Indie decides to leave hers in. They all agree to head back to the abandoned village. That night, Ky and Cassia share some time alone together, thinking not of their predicament but only of each other. When they reach the settlement the next morning, they hide in a house and observe as a man carries the dead body of a young girl out to a tree and buries her, singing mournfully as he works. He draws blue streaks up and down her arms in spite of the rain, and when he finishes, Ky and the others approach him. The man says his name is Hunter, the last of the farmers that inhabited the settlement until just recently. He agrees to give the four information about the Rising in exchange for a favor.
That night, while everyone else sleeps, Indie gives Ky the piece of paper from Xander that Cassia dropped, which reveals a secret of Xander's. Indie thinks Ky knows more about the Rising but for some reason won't tell them. Ky thinks Indie has something to hide, too. He releases Xander's paper in the wind.
In the morning, Hunter reveals that the dead girl he buried was his daughter, Sarah. He tells them that they're to head to the cave behind the artificial wall that Cassia and Indie found earlier, known as the Cavern. Hunter knows what's behind it but doesn't know why. He explains that the slew of dead bodies the girls found were farmers who had decided to fight off the coming air ships. The remaining farmers headed elsewhere. They climb into the other canyon and Hunter shows them a secret tunnel into the Cavern, which they climb through, Cassia getting stuck momentarily. The Cavern is enormous and contains hundreds of thousands of tubes of tissue samples from citizens of the Society, including Cassia and Xander. Hunter removes one and breaks it, setting off a red light on its container. Panicked that the Society is coming, the others escape as Hunter begins destroying the tubes in a fit of rage.
The four head back to the other canyon. Indie mentions Xander's secret, but Ky pretends not to know what she's talking about because he thinks Cassia will choose Xander's love over his if she knows the truth. Back in the cave above the village, they begin sorting through endless books and papers for anything on how to get to the Rising. Ky reveals that he learned how to sort like Cassia from an old miniport his adopted father illegally acquired for him. He thinks back to his father teaching him to write, how his father wanted to teach everyone to write and have everyone be part of the rebellion. His father also taught him how to wire. Indie pockets something that only Ky notices. Ky thinks the Rising can't be trusted since they didn't save him after his village was destroyed, and worries that it's the one place he cannot accompany Cassia.
That night, Cassia wishes to know more of Ky's story, but he's hesitant to reveal much. Indie heads down to the houses and Ky follows her, discovering that she has a miniport and Cassia's microcard with Xander's information on it. She reveals a map to the Rising that she found in the cave. They discuss becoming Aberrations. Ky says that the Society suspected his father of working with rebels, which was true, and reclassified them. Xander's secret is revealed: he's already part of the Rising. He was approached by rebels just before his and Cassia's Matching Banquet, as was Ky. Xander accepted, but Ky refused. Neither mentioned this to Cassia to avoid endangering her. Ky wants Indie to forget about the Rising, but her heart is set on it. Ky knows that it wasn't Indie's mother who tried to escape the Society in a boat, it was Indie herself. He strikes a match and sets the map on fire.
Hunter appears in the cave as Cassia continues to sort. He says he wishes he could've gone with the farmers who fled, but Sarah was too sick to be moved. Cassia sees the flames of the map down below, runs and takes it from Ky and puts it out, saving most of it. She confronts Ky and he admits he doesn't want to find the Rising. He wonders if she came to the Carving to find it or him. Hunter reminds them that time is short. He has a plan to cause a landslide and hide the cave. They return to it to retrieve supplies and Eli. Indie admits to having kept Cassia's microcard in the old wasp's nest in her bag. Cassia accuses Indie of being in love with Xander, which she doesn't deny. This makes Cassia jealous. Indie tells Cassia that she needs to pick one boy or the other.
Hunter and Ky retrieve a plastic boat built for two from the cave, and then set off an explosion that causes a landslide, concealing the cave and destroying a few houses in the village. They walk all day headed for the plain, and rest in a cave. They discuss the Rising and the farmers' former relationship with it. Hunter shows Cassia that the blue lines on his arm represent connection, and draws some on her. That night, while everyone sleeps, Ky draws an elaborate mural on the wall in the dark, depicting his parents, the river, and Cassia in a red dress. Cassia wakes to see it the next morning. When the group finally go as far as they can and need to split up, Cassia makes the difficult choice to take Eli in the boat with her. Eli, however, decides to go with Hunter, so Ky tells Cassia to take Indie and he'll catch up on foot.
Before saying goodbye, Ky reveals his intense guilt at having fled when he saw his parents' corpses. They say goodbye, and Indie and Cassia trek down the river, capsizing at one point and losing their things in the water. They regain themselves and eventually come to a vast lake, where a boat approaches them, to which Indie calls out that they've come to join the Rising. Ky trails behind on foot. He hides tissue sample tubes of Cassia's grandfather and Vick that Cassia and Eli respectively took from the Cavern, as well as some papers, in the dirt. Cassia and Indie are decontaminated and interviewed. Cassia is sorted into a rebel position in Central and leaves almost immediately. Ky is put through the same process when he arrives. He is assigned to be an air pilot in Camas Province. Ky finds Indie in the dining tent and she tells him Cassia has already left. Later, Ky finds an old Archivist who agrees to have the papers Ky buried in the woods delivered to Cassia.
A month and a half goes by, and Cassia is now a a rebel living in Central who strategically trades with other rebels. The book ends with her mentioning that she is planning to meet an undisclosed "him" that night, a "him" who is also part of the Rising.