The Restaurant at the End of the Universe (1980, ISBN 0-345-39181-0) is the second book in the Hitchhiker's Guide to the Galaxy comedy science fiction series by Douglas Adams. It was originally published by Pan Books as a paperback. The book was inspired by the song "Grand Hotel" by British rock band Procol Harum. It takes its name from Milliway's, the Restaurant at the End of the Universe, one of the settings of the book.
Zaphod and Marvin vanish, and reappear at the offices of the Guide on Ursa Minor Beta. They are looking for Zarniwoop, who has gone on an intergalactic cruise in his office via his virtual universe. Arthur, Trillian and Ford are unaware of any of this, knowing only that the computer has been shut down, and only having received a message from a stalling Nutrimatic that says "Wait."
When Zaphod and Marvin reach the fifteenth floor of the Guide's office, half of the building is lifted off the ground by Frogstar Fighters. A mysterious man named Roosta brings Zaphod to Zarniwoop's office, where they wait until the building lands on Frogstar World B. Roosta gives Zaphod final instructions before he leaves: go through the window on his way out, not the door. Zaphod then meets Gargravarr who informs Zaphod that he is to be sent through the Total Perspective Vortex, a machine which kills you by showing you just how how infinitely small you are compared to the universe. However, when Zaphod enters it, the Vortex shows him that he is the most important thing in the universe. Zaphod escapes, and finds Zarniwoop in the first class cabin of a spaceliner in an abandoned spaceport.
Zarniwoop explains that the Total Perspective Vortex has not malfunctioned: this is a virtual universe created by Zarniwoop for the sole benefit of Zaphod, who is indeed therefore the most important creature in this universe. It turns out that Zaphod had the shrunk Heart of Gold in his jacket pocket the whole time. It is reconstituted, and Zaphod is reunited with Trillian, Arthur and Ford. They escape from Zarniwoop by asking to be transported to the nearest restaurant. Milliways, the Restaurant at the End of the Universe, is the nearest restaurant in space but not time and so they are transported there. Marvin has spent the past several millennia parking diners' cars while waiting for the humans to return. After the meal, Zaphod and Ford steal a spaceship, which turns out to be a stuntship belonging to the rock band Disaster Area, programmed to dive into a star to provide backing effects for a rock concert.
The teleporter on the ship has no guidance system as it was never intended to be used, so they have to go wherever it takes them. Arthur and Ford end up in the Golgafrincham Ark Fleet Ship B, which crash-lands on prehistoric Earth. They realize that the bumbling travelers are the real ancestors of modern humans, not the Neanderthals originally inhabiting the planet. Arthur attempts to determine the Question to Ultimate Question of Life, the Universe and Everything by reaching into a rabbit-skin Scrabble bag and pulling out letters randomly, hoping Deep Thought's computational matrix in Earth would have rubbed off on his subconscious. The letters spell "What do you get when you multiply six by nine" before running out, although the Neanderthals manage to spell 42 with the tiles, implying that it is they rather than the Golgafrinchans who were intended to be part of Earth's computer matrix.
Zaphod and Trillian return to the Heart of Gold, which is commandeered by Zarniwoop to complete his mission: to discover who really rules the Universe.
Most significantly, in the radio series the ship stolen from the Restaurant at the End of the Universe belonged not to Disaster Area, but to the admiral of the fleet of a Haggunenons (a warlike "hyper-evolutionary" race), who would evolve into any random shape in a matter of seconds. This evolutionary instability made them very jealous of stable life forms or as they called them "filthy rotten stinking same-lings". If for example one was drinking coffee and could not reach the sugar it would, without a second thought evolve into something with much longer arms, but which was quite incapable of drinking the coffee.
In the original two radio series, Zaphod, Trillian and Marvin were all said to have escaped when the Hagunnenon Admiral "re-evolved" into an escape capsule. Zaphod wound up at the Hitchhiker's Guide offices, Trillian was married off and disappeared from the series, and Marvin wound up through "a string of adventures" before also arriving at the Hitchhiker's Guide offices. This was changed slightly in the 2004-05 radio series adaptations of the final three books: Zaphod is told that he and Trillian escaped back to the Heart of Gold together, and Marvin was left behind on the stolen Haggunenon Admiral's flagship, before being rescued. However, the original storyline is not completely ignored: instead it was a byproduct timeline caused by the Vogons interfering with the probability axis, combined with the effects of the Total Perspective Vortex.