Seventeen year-old Cassia lives in a futuristic, seemingly utopian Society in which the citizens' lives are strictly controlled by the government - the government decides where they live, where they work, who they care about and even when they die (all citizens die at the age of 80). At the age of seventeen, citizens undergo the process of being "matched"- becoming paired up with another boy/girl selected by the authorities. Typically, young men and women are Matched with someone from another town, sometimes even another province; they generally do not know their Match ahead of time, but are shown their face over a television screen and subsequently provided with a picture and information about the match on a "microcard" - a piece of storage similar to a floppy disk or flash drive. Matched couples are given a period of courtship, and are then married when they turn 21. The system was devised to give couples their best chance at having healthy children. In return, citizens of the Society "live longer and better than any other citizens in the history of the world."
At the beginning of the novel, Cassia is led to the Match Banquet by her parents, an elaborate event that happens across her country in different towns at the same time. When Cassia's name is called at the Banquet, the TV screen stays dark - which means that her Match is somewhere in the same room, from her own town of Mapletree Borough, which rarely happens. She becomes overjoyed when she realizes that her Match is her best friend, Xander Carrow, who goes to her Second School (high school) and grew up on the same street as she. Cassia is excited about their future together, although her excitement is tempered a bit by disappointment that she already knows everything about Xander and will not have the exciting experience of meeting him for the first time.
As the novel progresses, the Society is increasingly portrayed as dystopian. Families are provided with tasteless rationed food, controlled for calories and nutrition; there is strict population control, and every family has a "port" in their household - a two-way television that allows the government to monitor their behavior, as well as for them to respond to government questions. The ports are also how people read microcards with stored information on them. All people are revealed to have to die on their 80th birthday - in order to make this happen, the Society slowly starts to poison the seniors' food when they are reaching the end of their 79th year. The Society has also decided that their former culture was too "cluttered" and thus eliminated most traces of culture, saving only 100 of everything - the Hundred Poems, Hundred Paintings, Hundred Stories, Hundred Songs, etc. At night, citizens take turn with their family members wearing "data tags", which collect information on their dreams to help predict their behavior. Every citizen must also carry three pills on them - one blue, one green, and one red - although initially it is not revealed what the tablets do. Cassia carries her pills in an 'artifact' - a possession from the past that was given to her by her grandfather - that used to be a powder compact used by her great-grandmother. People's actions are predicted using sophisticated psychological and statistical techniques, referred to as "sorting." Cassia's assigned adult job is as a sorter, and she is noted to be gifted at this particular job. Cassia enjoys it, but notes that she does not want to sort real people - such as sorting them into jobs or Matches.
After school and practicing her trade, Cassia returns home and decides to view the information about Xander on her microcard on the port. When she inserts the microcard, Xander's face pops up, but then the screen glitches and displays another face: that of Ky Markham, another young man who lives in her borough. Ky is an aberration, which is a person who has been revoked of citizen status. Ky was adopted by his aunt and uncle, Aida and Patrick Markham, after their own son was killed by a dangerous Anomaly, an outcast member of society. Ky is good-looking, but he is very quiet and keeps to himself, having left school early to accept his work assignment at the nutrition disposal center, a notoriously difficult job. The Official confides in Cassia that Ky is not meant to be Matched with anyone, as he is an Aberration: a semi-outcast member of society who usually acquires this identity through committing an "Infraction." A Society Official tells Cassia that Ky's father committed a serious Infraction, and although Ky was allowed to be adopted by his aunt and uncle at a young age, he had to retain his identity as an Aberration and therefore cannot be Matched with anyone. Cassia only tells her beloved grandfather, a man nearing his 80th birthday and therefore his death - as all Society citizens die on their 80th birthday, which was mentioned before. Her grandfather encourages her to find the words within her and gives her a forbidden piece of paper.
Cassia has chosen hiking as her summer recreation activity, and while in the woods she peeks at her grandfather's paper. On it are two poems that are not in the Society's allotted Hundred Poems, a dangerous infraction. Coincidentally, Ky Markham has also chosen hiking, and he spots her in the woods reading the paper. He promises to keep her secret and help her destroy the poems after she memorizes them. As he helps her first destroy the poems then preserve the memory of them - and teaches her how to write words in the dirt - Cassia slowly falls in love with Ky, and he with her. Her growing feelings for Ky make her question her relationship with Xander and the wisdom of the Matching system; over time, she grows more and more frustrated with the Society's control over her relationship and her ability to express herself through poetry and writing, which is forbidden.
Gradually, Cassia begins to discover that the Society is not as utopian as she had once thought - in that people's freedoms are severely restricted, and the people are not allowed to make choices about their own desires and wants - including who they want to spend their lives with and whether they would like to be preserved for science at all. Cassia struggles with her inner desire to rebel and her more overt desire to remain docile, give into the Society and allow it to take care of her basic needs in return for a loss of freedom. It is also gradually revealed what the three tablets do: the green is a sort of sedative that calms people when they have anxiety. The blue tablet is described as providing nourishment for people who may be separated from food for a long time. And the red tablet causes people to forget anything that has happened in the last 12 hours, though it is revealed that it has no effect on some people, like Xander and Ky. The Officials take all the artifacts because they are considered "Unequal". Cassia later gets news that she is being forced to leave Maple Tree borough.