A number of historical events inspired Voltaire to write Candide, most notably the publication of Leibniz's "Monadology", a short metaphysical treatise, the Seven Years' War, and the 1755 Lisbon earthquake. Both of the latter catastrophes are frequently referred to in Candide and are cited by scholars as reasons for its composition. The 1755 Lisbon earthquake, tsunami, and resulting fires of All Saints' Day, had a strong influence on theologians of the day and on Voltaire, who was himself disillusioned by them. The earthquake had an especially large effect on the contemporary doctrine of optimism, a philosophical system which implies that such events should not occur. Optimism is founded on the theodicy of Gottfried Wilhelm Leibniz that says all is for the best because God is a benevolent deity. This concept is often put into the form, "all is for the best in the best of all possible worlds" (Fr. Tout est pour le mieux dans le meilleur des mondes). Philosophers had trouble fitting the horrors of this earthquake into the optimist world view.
Voltaire actively rejected Leibnizian optimism after the natural disaster, convinced that if this were the best possible world, it should surely be better than it is. In both Candide and Poème sur le désastre de Lisbonne ("Poem on the Lisbon Disaster"), Voltaire attacks this optimist belief. He makes use of the Lisbon earthquake in both Candide and his Poème to argue this point, sarcastically describing the catastrophe as one of the most horrible disasters "in the best of all possible worlds". Immediately after the earthquake, unreliable rumours circulated around Europe, sometimes overestimating the severity of the event. Ira Wade, a noted expert on Voltaire and Candide, has analysed which sources Voltaire might have referenced in learning of the event. Wade speculates that Voltaire's primary source for information on the Lisbon earthquake was the 1755 work Relation historique du Tremblement de Terre survenu à Lisbonne by Ange Goudar.
Apart from such events, contemporaneous stereotypes of the German personality may have been a source of inspiration for the text, as they were for Simplicius Simplicissimus, a 1669 satirical picaresque novel written by Hans Jakob Christoffel von Grimmelshausen and inspired by the Thirty Years' War. The protagonist of this novel, who was supposed to embody stereotypically German characteristics, is quite similar to the protagonist of Candide. These stereotypes, according to Voltaire biographer Alfred Owen Aldridge, include "extreme credulousness or sentimental simplicity", two of Candide's, and Simplicius's, defining qualities. Aldridge writes, "Since Voltaire admitted familiarity with fifteenth-century German authors who used a bold and buffoonish style, it is quite possible that he knew Simplicissimus as well."
A satirical and parodic precursor of Candide, Jonathan Swift's Gulliver's Travels (1726) is one of Candide's closest literary relatives. This satire tells the story of "a gullible ingenue", Gulliver, who (like Candide) travels to several "remote nations" and is hardened by the many misfortunes which befall him. As evidenced by similarities between the two books, Voltaire probably drew upon Gulliver's Travels for inspiration while writing Candide. Other probable sources of inspiration for Candide are Télémaque (1699) by François Fénelon and Cosmopolite (1753) by Louis-Charles Fougeret de Monbron. Candide's parody of the bildungsroman is probably based on Télémaque, which includes the prototypical parody of the sagacious tutor on whom Pangloss may have been partly based. Likewise, Monbron's protagonist undergoes a disillusioning series of travels similar to those of Candide.