"Mirrors" was written and produced by Justin Timberlake, Timothy "Timbaland" Mosley and Jerome "J-Roc" Harmon, with additional writing from James Fauntleroy.[1] During an interview with Billboardmagazine, Harmon recalled how the song was conceived in 2009, during the recording sessions for Timbaland's third studio album Shock Value II, "He's [Timberlake] like, 'I'm gonna save this one, and this is gonna go on my album.' We never knew when he was going to put it out – we were like, 'Aw man, you're in movies now!' We could have waited another 10, 15 years. But then he surprised us last year and said he was ready, and he brought ['Mirrors'] over to the project as well."[2]
Although the final version of "Mirrors" is eight minutes long, Harmon stated that its second half which is more R&B oriented in comparison with the first part which is rock-influenced was made years later and independent of the original track, "We segued each piece to go into another song, so if you were to break it up, that second part of 'Mirrors' is like a song by itself. Once we got all the songs that [Timberlake] knew he wanted on this album, then that's when we began to tie everything together, and the second part just fell in order."[2]
"Mirrors" was engineered by Chris Godbey, with assistance from Alejandro Baima. Timberlake arranged and produced his vocals, which were recorded at Larabee Studios in North Hollywood, California. The song was mixed by Jimmy Douglass, Godbey and Timberlake at Larabee Studios. Harmon provided keyboards for the song, while Elliot Ives played the guitar. The strings in the song were played by Benjamin Wright and The Benjamin Wright Orchestra.