"When She Loved Me" is a song written by American musician Randy Newman and recorded by Canadian singer Sarah McLachlan for Pixar's animated film Toy Story 2 (1999). The song is sung by the character Jessie, a toy cowgirl, as she reveals her backstory by reflecting upon her defunct relationship with her original owner, by whom she was outgrown. Heard in the film during a flashback sequence, the filmmakers decided to incorporate a song into the montage during which Jessie details her backstory to Woody after multiple attempts to show the character relaying her experience verbally proved unsuccessful.

Newman initially felt that the song was inappropriate, doubting that young children would be interested in it; he changed his mind after screen tests showed optimistic results. The song was offered to McLachlan after Newman and the filmmakers agreed that the ballad was more appropriate for a female artist. Despite some hesitation from her management, McLachlan greatly enjoyed the ballad and agreed to record it upon hearing Newman's demo, finding herself drawn towards its melancholy nature. Musically, "When She Loved Me" is an emotional pop ballad backed by simple piano accompaniment. Various interpretations of the song's lyrics and themes have been offered; while written primarily about the pain felt upon losing a platonic friend, "When She Loved Me" has also been interpreted as a love song, while some music journalists consider the track to be a metaphor for children inevitably growing up and becoming independent from their parents.

When She Loved Me

"When She Loved Me" has garnered critical acclaim from film and music critics, who found the song to be both moving and heartbreaking, praising Newman's songwriting and McLachlan's vocal performance. "When She Loved Me" won a Grammy Award for Best Song Written for a Motion Picture, Television or Other Visual Media. The song was nominated for Golden Globe and Academy Awards for Best Original Song. "When She Loved Me" has since earned a reputation as one of the saddest sequences in both Pixar and Disney films, as well as one of the saddest film songs ever written. The song has been covered by several artists, including Steve Tyrell, Bridgit Mendler and the musical group Steps.

When She Loved Me

Writing and recording

Beginning with Toy Story (1995), director John Lasseter had long decided that Pixar films would not be musicals in which characters spontaneously perform songs, but agreed that musician Randy Newman should write original songs for certain moments during the story, most of which he would sing himself, but in the case of this film, the character Jessie herself would sing this particular song. Originally, the filmmakers had considered having Jessie, a toy cowgirl, simply explain her backstory verbally; this concept was re-visited several times until the idea of re-working her thoughts into a song called "When She Loved Me" was suggested. Lasseter identified the addition of the song as the film's most significant production change. Newman, however, doubted that "When She Loved Me" would work, initially thinking that the filmmakers were mistaken by incorporating it into the film, due to the song essentially being about the difference between feeling loved and unloved. The songwriter called the ballad a risk due to the studio's history of fearing slowing down films too much and losing the audience's interest in the process. Newman continued to doubt that children would be able to sit through the song until he observed their behavior during an initial screening. He was ultimately surprised to find that even the youngest children in the audience remained attentive during the song despite its slow tempo and mature, emotional themes. Newman joked that the song was not "the first time [Pixar] knew better than I did", explaining, "I wrote something that must have worked or the kids would have been running up the aisle." Lasseter admitted that he is most proud of the way in which "When She Loved Me" was used in the film.

When She Loved Me