Lehrer was born in 1928 to a Jewish family and grew up in Manhattan's Upper East Side. Although he was raised Jewish, Lehrer became an agnostic. He began studying classical piano at the age of seven, but was more interested in the popular music of the age. Eventually, his mother also sent him to a popular-music piano teacher.

In 1953, inspired by the success of his performances, Lehrer paid $15 for some studio time to record Songs by Tom Lehrer. The initial pressing was 400 copies. At the time, radio stations would not give Lehrer air time because of his controversial subjects. He sold his album on campus at Harvard for $3 (equivalent to $27.00 today), while "several stores near the Harvard campus sold it for $3.50, taking only a minimal markup as a kind of community service. Newsstands on campus sold it for the same price." After one summer, he started to receive mail orders from all parts of the country (as far away as San Francisco, after The Chronicle wrote an article on the record). Interest in his recordings was spread by word of mouth; friends and supporters brought their records home and played them for their friends, who then also wanted a copy. Lehrer later recalled, "Lacking exposure in the media, my songs spread slowly. Like herpes, rather than ebola."  The album--which included the macabre "I Hold Your Hand in Mine", the mildly risque "Be Prepared", and "Lobachevsky" (regarding plagiarizing mathematicians)--became a cult success via word of mouth, despite being self-published and without promotion. Lehrer embarked on a series of concert tours and in 1959 recorded a second album, which was released in two versions: the songs were the same, but More of Tom Lehrer was studio-recorded while An Evening Wasted with Tom Lehrer was recorded live in concert. In 2013, Lehrer recalled the studio session for "Poisoning Pigeons in the Park," which referred to the practice of controlling pigeons in Boston with strychnine-treated corn:  "The copyist arrived at the last minute with the parts and passed them out to the band... And there was no title on it, and there was no lyrics. And so they ran through it, 'what a pleasant little waltz'... And the engineer said, '"Poisoning Pigeons in the Park,' take one," and the piano player said, '"What?"' and literally fell off the stool."

What genre of music did he make?