On Aug. 5, 1966, the Beatles released “Yellow Submarine,” a track purposefully designed as a children’s song.

The tune came to Paul McCartney one night while at the home of his girlfriend, actress Jane Asher.

"I was laying in bed in the Asher's garret, and there's a nice twilight zone just as you're drifting into sleep and as you wake from it,” he recalled in the book Many Years From Now. "I always find it quite a comfortable zone, you’re almost asleep, you’ve laid your burdens down for the day and there’s this little limbo land just before you slip to sleep.”

Caught in a half-awake, half-asleep trance, McCartney’s mind began to race: “I remember thinking that a children's song would be quite a good idea, and I thought of images, and the color yellow came to me, and a submarine came to me, and I thought, ‘Well, that’s kind of nice, like a toy, very childish yellow submarine.”

McCartney had been trying to come up with a song to feature Beatles’ drummer Ringo Starr on lead vocals. “Yellow Submarine” seemed like it could be the perfect vehicle.

“I wrote it as not too rangy in the vocal,” McCartney explained. “I just made up a little tune in my head, then started making a story, sort of an ancient mariner, telling the young kids where he'd lived and how there’d been a yellow submarine.”

The track’s simple structure was by design, “so kids could understand it.” Bandmate John Lennon would later help with the melody, imparting an idea from a previous song he had discarded. Scottish singer Donovan, with whom McCartney was good friends, contributed as well, coming up with the line “Sky of blue and sea of green in our yellow submarine."

Listen to the Beatles' 'Yellow Submarine'

The Beatles recorded "Yellow Submarine" during the 1966 sessions for Revolver. Producer George Martin, who had cut his teeth producing comedy albums for the likes of Peter Sellers, utilized everyone he could when it came to layering effects on the track.

George Harrison made the sound of waves by swirling water in a bathtub. His wife at the time, Pattie Boyd, lent her voice to some high-pitched shrieks. The Rolling StonesBrian Jones clinked glasses together and played an ocarina. Members of the Beatles’ larger team - including road managers Mal Evans and Neil Aspinall and driver Alf Bicknell - rattled chains, blew whistles and generally added to the chorus of sounds. All of these elements were used to bring the fantasy world of “Yellow Submarine” to life.

The single was released as a double A-side with “Eleanor Rigby” on Aug. 5, 1966. “Yellow Submarine” would quickly top charts around the world, reaching No. 1 in 11 countries, including the U.K., Australia and Canada. In the U.S., it stalled at No. 2, kept out of the top spot by “You Can’t Hurry Love” by the Supremes.

Two years later, “Yellow Submarine” would spawn an animated movie of the same name, which remains a hit among generations of fans, both old and young - appropriate considering the childlike qualities that inspired the original song.

The Best Song From Every Beatles Album

Consensus can be difficult to reach on which Beatles album is best – much less which song.