Before recording her debut album, Spears had originally envisioned it in style of "Sheryl Crow music,  but younger [and] more adult contemporary". However, the singer agreed with her label's appointment of producers, who had the objective to target a teenage audience at the time. She flew to Cheiron Studios in Stockholm, Sweden, where half of the album was recorded in May 1998, with producers Max Martin, Denniz Pop and Rami Yacoub, among others. "(You Drive Me) Crazy" was written by Jörgen Elofsson, while song production and additional songwriting was done by Martin, Per Magnusson and David Kreuger. Spears recorded the vocals for the song in March 1998, at Cheiron Studios in Stockholm, Sweden. It was also mixed at Cheiron Studios by Martin. Esbjörn Öhrwall and Johan Carlberg played the guitar, while bass guitar was done by Thomas Lindberg. Keyboards and programming was done by Kreuger, and additional keyboards by Magnusson. Background vocals were provided by Jeanette Söderholm, Martin, Yacoub and THE FANCHOIR, formed by Chatrin Nyström, Jeanette Stenhammar, Johanna Stenhammar, Charlotte Björkman and Therese Ancker. In May 1999, Martin and Spears went to the Battery Studios in New York City, New York, to re-record the vocals of the track, due to the fact that a remixed version called "The Stop! Remix" was going to be included on the original motion picture soundtrack of the film Drive Me Crazy (1999). "(You Drive Me) Crazy" was released as a remix package as the third single from ...Baby One More Time on August 23, 1999.