Diane Warren wrote "Un-Break My Heart" in 1995. When asked about her songwriting process, she said that songs usually come to her from a title, a chorus, or a drum beat. "Un-Break My Heart" was conceived from its title, and, according to Warren, "it popped into my head, and I thought, 'I don't think I've heard that before, that's kind of interesting.' I started playing around on the piano with these chords and did a key change, and then I knew, 'OK, this is magic.'" Warren further explained that she wrote "Un-Break My Heart" as a ballad and dance song, because that was the way she heard it. She said: "some people only know it as a – gay – dance song!"
When Warren played the finished song to Arista Records' president L.A. Reid, he thought it would fit Braxton's then upcoming album. When "Un-Break My Heart" was sent to Braxton, she expressed dislike for the song. According to Warren, "Toni hated the song. She didn't want to do it." Reid was able to convince Braxton to record it, and it later became her signature song. Following the recording sessions of the song, Braxton approached Warren and explained why she was skeptical about recording it, further explaining that she didn't want another "heartbreak track".
Recording sessions occurred at The Record Plant and Chartmarker Studios in Los Angeles, California in the same year. "Un-Break My Heart" was released as the second single from Secrets on November 11, 1996.