Reznor wrote the song after the extended play Broken (1992) was completed. It was initially a poem which he expanded into a full song. He later moved to a house famous for its status as the site of the gruesome Tate murders, on July 4, 1992, and created a studio space there, calling it Le Pig. When asked about the building where production on the song was done, Reznor responded that he chose it merely for space considerations, claiming not to have been aware of the house's connection to the murders until after he chose it. "I looked at a lot of places", Reznor said. "And this just happened to be the one I liked most."
The studio name, Le Pig, alludes to the word "PIG" written with Tate's blood on the front door by the murderers, itself a reference to The Beatles' song "Piggies". This incident introduced Reznor to their 1968 album, the White Album, which included "Piggies".
The frantic drumming on the outro is Reznor's only attempt at performing drums on the record, and one of the few "live" drum performances on the album. He had stated that the recording was from him testing the microphone setup in studio, but he liked the sound too much not to include it.