Euclid of Megara (ˈjuːklɪd; Εὐκλείδης ; c. 435 – c. 365 BC) was a Greek Socratic philosopher who founded the Megarian school of philosophy. He was a pupil of Socrates in the late 5th century BC, and was present at his death. He held the supreme good to be one, eternal and unchangeable, and denied the existence of anything contrary to the good. Editors and translators in the Middle Ages often confused him with Euclid of Alexandria when discussing the latter's Elements.
Euclid was born in Megara. In Athens he became a follower of Socrates: so eager was he to hear the teaching and discourse of Socrates, that when, for a time, Athens had a ban on any citizen of Megara entering the city, Euclid would sneak into Athens after nightfall disguised as a woman, to hear him speak. He is represented in the preface of Plato's Theaetetus as being responsible for writing down the conversation between Socrates and the young Theaetetus many years earlier. Socrates is also supposed to have reproved Euclid for his fondness for eristic disputes. He was present at Socrates' death (399 BCE), after which Euclid returned to Megara, where he offered refuge to Plato and other frightened pupils of Socrates.
In Megara, Euclid founded a school of philosophy which became known as the Megarian school, and which flourished for about a century. Euclid's pupils were said to have been Ichthyas, the second leader of the Megarian school; Eubulides of Miletus; Clinomachus; and Thrasymachus of Corinth. Thrasymachus was a teacher of Stilpo, who was the teacher of Zeno of Citium, the founder of the Stoic school.
Euclid himself wrote six dialogues—the Lamprias, the Aeschines, the Phoenix, the Crito, the Alcibiades, and the Amatory dialogue—but none survive. According to its prologue, the ostensibly Platonic dialogue Theaetetus was originally a Euclidean work. The main extant source on his views is the brief summary by Diogenes Laërtius. Euclid's philosophy was a synthesis of Eleatic and Socratic ideas. Socrates claimed that the greatest knowledge was understanding the good.