In the fall of 2012, Zach Sobiech performs an acoustic rendition of “Sexy and I Know It” to an amused crowd at his school’s talent show. Zach has been struggling with osteosarcoma and has been receiving regular treatments for it. His best friend, Sammy Brown, conspires with him by helping him to write music (“Blueberries”). Zach manages to ask out fellow student Amy Adamle for a picnic, but before he is able to do so, he begins to have a coughing fit that concerns his mother, Laura, who rushes him to the hospital. He has a collapsed lung and an emergency surgery is performed on him. While they fix his lung, they learn that the treatments are no longer effective and his cancer is now terminal, giving him six to ten months to live. Zach tells Sammy and Amy about his diagnosis while he is inspired by his teacher, Milton Weaver, about what he is to do with the rest of his life.
In the winter of 2012, Zach and his family go to Lourdes, France, in Laura’s desperate attempt at Zach having some sort of miracle. Zach returns home to hang out with Sammy (“Coffee Cup”) and learns that she has bought tickets to a Jason Mraz concert. Zach decides to use the opportunity to ask Amy out to prom and she accepts (“I’m Yours”). After having convulsions, Zach goes to Sammy’s house in the middle of the night demanding that they form a band. Both realize that they have romantic feelings for each other, but that they are incapable of having a full relationship. They continue to bond over songwriting (“Fix Me Up”) and Sammy posts their music on YouTube which earns them some fame. Despite this, Zach is certain that he will fail to achieve anything beyond the video. He is later given encouragement by Mr. Weaver.
Zach’s father, Rob, borrows a Nissan GT-R for him to drive and impress Amy with. While at her house, the two proceed to make out (“My Little Dancer”), but when Amy comments on his scars, Zach becomes despondent and tells her that he will never offer the things she wants from him and breaks up with her while leaving in a huff. Laura confronts Rob over the decision to get a car for Zach and he breaks down admitting that he did it to make his son happy as he is unable to do anything about his eventual death. In the spring of 2013, Weaver reveals to Zach and Sammy that he showed their video to BMI and that they want to sign them. They head to New York City to sign their contracts, calling their band A Firm Handshake (“Ames”). On the flight back home, Zach suddenly has a moment of creative energy and writes the song “Clouds” and records it shortly afterwards, becoming a colossal hit.
Zach finally makes the time to apologize to Amy about his behavior and the two of them get back together. Zach speaks privately to his mother about how to handle his remains and his funeral, suggesting bagpipes be played. Sammy and the Sobiechs learn that Zach might not make it to prom. With Zach having been given the opportunity to play at the Metro Theatre, they decide to combine the concert with prom, a graduation, and a fundraiser for osteosarcoma. The day arrives and despite Zach’s worsening condition, he decides to go perform anyway. Sammy begins the show by performing “How to Go to Confession” before Zach heads out to perform “Clouds”. Zach’s breathing begins to labor, but he is moved when the entire audience sings the song for him.
Zach passes away on May 20, 2013. Even though he never made it, Zach wrote a college essay telling people that you don’t need to find out you’re dying to start living. Sammy, Amy and other friends come together for a group photo in remembrance of Zach; noticing that a cloud in the sky resembles a “Z”. During the credits, footage of the real Zach and Sammy play combined with footage of the filmmakers filming scenes of the movie as well as the cast and crew meeting with the real people involved in Zach’s life (“Sandcastles”).