Hazel Grace Lancaster, a 16-year-old with thyroid cancer that has spread to her lungs, attends a cancer patient support group at her mother's behest. During a support meeting, Hazel meets a 17-year-old teenage boy named Augustus Waters, whose osteosarcoma caused him to lose his leg. Augustus is at the meeting to support his friend, Isaac, who is losing his remaining eye to cancer. The two bond immediately after the meeting and Augustus invites Hazel to his house where the two strengthen their bond over a movie and their experiences with cancer. Before departing, the two agree to read each other's favorite novels. Augustus gives Hazel The Price of Dawn, and Hazel recommends An Imperial Affliction, a novel written by Peter Van Houten about a cancer-stricken girl named Anna that parallels Hazel's own experience. After Augustus finishes reading her book, he is frustrated upon learning that the novel ends abruptly without a conclusion. Hazel explains the novel's author had retreated following the novel's publication and has not been heard from since.
A week later, Augustus reveals to Hazel that he has tracked down Van Houten's assistant, Lidewij, and, through her, has managed to start an e-mail correspondence with Van Houten. The two wrote to Van Houten with questions regarding the novel's ending and the fate of the mother of Anna. Van Houten eventually replies, explaining that he can only answer Hazel's questions in person. Hazel proposes the trip to her mother but is rejected due to financial and medical constraints. Later, at a picnic, Augustus surprises Hazel with tickets to Amsterdam to meet Van Houten. She is thrilled, but feels hesitant for some reason. A comment on Augustus' late girlfriend causes Hazel to compare herself to a grenade; Hazel fears hurting others when she dies.
As she struggles with her love for Augustus and her death, Hazel suffers an episode of pleural effusion and is sent to the Intensive Care Unit (ICU) prompting her parents and her doctors to question the safety of overseas travel. The medical team argues against the trip until Dr. Maria, one of the physicians most familiar with her case, speaks up convincing Hazel's parents and physicians that Hazel must travel. When Hazel and Augustus first get to Amsterdam, they go to a restaurant and find that Van Houten paid for their meal and champagne. Augustus then confesses his love for Hazel that night. Hazel and Augustus finally meet Van Houten but are shocked to find that, instead of a literary genius, he is a mean-spirited drunk. Horrified by Van Houten's behavior, Lidewij confesses to having arranged the meeting on his behalf, angering Van Houten, who proceeds to insult Hazel's cancer, starting an argument and causing Hazel and Augustus to flee from the drunken author's home.
Accompanied by Lidewij, Hazel and Augustus then visit the Anne Frank House. After a struggling climb and kissing to applause, Augustus and Hazel return to their hotel. Shortly after returning to the hotel they end up getting intimate, where Hazel discovers that Augustus has been suffering cancer pains from time to time. The next day, Augustus confesses that his health is not as good as Hazel had been led to believe. The two affirm their love and support for each other. Upon their return to Indianapolis, Augustus' health worsens and he ends up in the ICU for a few days. Fearing his death, Augustus invites Isaac and Hazel to his pre-funeral, where they give eulogies. An extremely sick Augustus passes away soon after.
After this traumatic event, Van Houten shows up to apologize to Hazel. A few days later, while talking with Isaac, Hazel learns that Augustus may have been writing a sequel to An Imperial Affliction for her. As Hazel searches for the pages, she again encounters Van Houten. He confides in Hazel that his novel was a literary attempt to reconcile with the death of his daughter, Anna, who died from cancer when she was eight. Hazel tells Van Houten to sober up and write another book.
Eventually Hazel learns that Augustus sent the pages to Van Houten because he wanted Van Houten to use the pages to compose a well-written eulogy about Hazel as she did for him. Lidewij forces Van Houten to read the pages and sends them to Hazel. Hazel reads Augustus's words. He says getting hurt in this world is inevitable, but we do get to choose who we allow to hurt us, and that he is happy with his choice. He hopes she likes her choice too. Hazel states she does.