Writing and production
Developed in September 2013 by Trainor and American songwriter and producer Kevin Kadish, "All About That Bass" was written in 40 minutes. At the time the song was written, Trainor lacked a recording contract but was writing tracks for other artists. Kadish recalled the session as "a blind date" and felt they had a strong chemistry. The pair wrote the song with the intention of handing it to another recording artist. Kadish then proposed the song title "All Bass, No Treble" to Trainor who, at the time, was in a phase of saying "I'm all about that Mexican food." She then responded to Kadish with the track's hook, "I'm all about that bass, no treble". Suggesting the topics "booty" and thickness for the song, Trainor got inspiration from the size difference between the bottom and top sections of a double bass.
Trainor and Kadish discussed their love for 1950s music, and decided to incorporate the style into the song along with doo-wop because Trainor felt that the genre was very catchy. Kadish then developed a modern beat for the song and Trainor began freestyling the first verse. She felt encouraged by the result and pictured the song to contain a theme of girl power. Trainor intended for the song's lyrics to be about self-acceptance of body type, a theme inspired by her own struggles in self-image as a teenager. Kadish related to Trainor's lyric ideas due to his own experiences with weight insecurities during adolescence. Trainor wanted the track to criticize the use of photoshopped images after she saw a feature on The Ellen DeGeneres Show of a model whose photographs were graphically edited. She obtained additional inspiration for the song from American singer Bruno Mars' "Just the Way You Are" (2010) and The Chordettes' "Lollipop" (1958).
While Trainor and Kadish were happy with the song after it was finished, they doubted its commercial prospects. They pitched the song to a variety of record labels, but all of them were critical that the track did not have more mainstream appeal and the production team did not make use of a synthesizer or Auto-Tune. The song was further criticized for not having a "big chorus", a suggestion that Trainor and Kadish balked at. Trainor recorded a demo of the song and met Paul Pontius, the A&R for Epic Records chairman L.A. Reid, and performed the track for him. Even though Trainor was nervous, she later performed it for Reid while accompanying herself on a ukulele. After signing Trainor to Epic, Reid made a decision the final cut would be the same version as the demo but with additional mastering. "All About That Bass" was recorded at The Carriage House in Nolensville, Tennessee. Trainor's vocals were recorded by Kadish, who was also responsible for the track's mixing, programming, sound design, and engineering. The song's instrumentation includes electric guitar, bass, and drums played by Kadish; and piano, baritone, saxophone, and Hammond organ played by David Baron. Trainor provided the track's clapping and additional percussion. The song was mastered by David Kutch at The Mastering Palace, New York City.