Megara is an ancient city in Attica, Greece, on the Saronic Gulf opposite the island of Salamis, which belonged to Megara in archaic times, before being taken by Athens. Megara was one of the four districts of Attica, embodied in the four mythic sons of King Pandion, of whom Nisos was the ruler of Megara.

In historical times, colonists from Megara (c. 667 BC) founded Byzantium, as well as Chalcedon and, in Sicily, Hyblaean Megara, a small polis north of Syracuse. The most famous citizen of Megara in antiquity was Euclid, but the 6th century poet Theognis also came from Megara.

In the Peloponnesian War, (c. 431 BC-404 BC) Megara was an ally of Sparta.

Today, Megara is a suburb of Athens, and is home to 10,000 people, especially the municipality. Distance is 42 km WNW of Athens, and is linked by a federal or state freeway connecting the Peloponnese, Western Greece, and Athens. It will now by linked by a high-speed rail line. The neighboring city to the east is Neos Peramos, and Kakia Skala to its west.

In Greek mythology Megara was the Theban wife of Heracles. There is a hexameter poem on her, usually attributed to Moschus. Megara figures prominently in most of the contemporary action hero retellings loosely based on Hercules' myths.