The first mechanical computer was the Antikythera mechanism, built by unknown Greek craftsmen around 150–100 BCE. It used at least 30 interlocking bronze gears to model the motions of the Sun and Moon and predict eclipses decades in advance. No single named inventor survives. The first mechanical computer with a documented inventor was Charles Babbage's Difference Engine, designed in 1822.

That pair of answers matters because "first mechanical computer" splits into two questions. One is about the earliest surviving geared calculating machine. The other is about the first machine designed as a general-purpose, programmable computer. Historians answer them differently, and the gap between them is roughly 1,900 years.

The Antikythera mechanism: gears before gears were supposed to exist

Sponge divers recovered the Antikythera shipwreck off the Greek island of Antikythera in 1901. The corroded lump of bronze sat in Athens for decades before anyone realized it contained gear teeth. Modern X-ray and CT scanning revealed a calendar computer with a front dial showing the zodiac and a 365-day Egyptian-style calendar ring.

The mechanism's core trick is mechanical modeling of cycles that do not divide evenly. The Moon's phase cycle, the lunar month, and the solar year all drift against each other. The device handles this with a pin-and-slot arrangement that reproduces the Moon's variable orbital speed, including a second-order correction for the Moon's elliptical orbit.

Its eclipse prediction works through the Saros cycle, a 223-lunar-month rhythm after which eclipse geometry nearly repeats. A spiral dial tracked this cycle across roughly 18 years. Another spiral dial, the Metonic dial, tracked the 19-year lunisolar cycle used to align calendar months with solar years.

The gear count is the headline number. Published reconstructions describe at least 30 gears, and some analyses suggest more were lost to corrosion. The largest surviving gear carries 223 teeth. That count is not arbitrary; it encodes the Saros period directly into the hardware.

A professional caveat here: nobody knows who built it. Inscriptions suggest a Corinthian calendar tradition, and some scholars argue for a Syracuse connection to Archimedes' school, but that is inference, not evidence. The honest answer to "who invented it" is that the inventor is anonymous.

Quantified context: what the numbers actually say

The Antikythera mechanism dates to roughly 150–100 BCE, based on calendar inscriptions and stylistic analysis. It predates any comparable geared device in the surviving record by more than 1,000 years. Nothing of similar mechanical complexity appears again until the astronomical clocks of medieval Europe.

Charles Babbage presented his Difference Engine design to the Royal Astronomical Society in 1822. He began construction with government funding and produced a small working demonstration model around 1822. A full engine would have required about 25,000 parts and weighed roughly 15 tons in Babbage's largest plan.

His Analytical Engine, designed from 1833 onward, is the machine that earns the "first computer" label. It specified separate storage and processing, punched-card input, and conditional branching. Ada Lovelace published her notes on it in 1843, including the first published algorithm intended for a machine.

The Difference Engine was finally built to Babbage's original spec in 1991, at the Science Museum in London. It has 8,000 parts, weighs about 5 tons, and calculates to 31 digits. It worked exactly as designed, which settles the argument about whether Babbage's engineering was sound.

Significant figures, as a system of units: none of these numbers involve conversion ambiguity. They are counts, dates, and physical mass in tons and parts.

Edge cases: where the "first" labels get slippery

Three edge cases complicate any clean answer.

The first is definitional. If "mechanical computer" means a geared device that models astronomical cycles, the Antikythera mechanism wins by default. If it means a machine that executes arbitrary arithmetic under stored instructions, the Analytical Engine wins. If it means one that was actually completed and ran, neither wins.

The second is the astrolabe and the slide rule. Both are mechanical aids to calculation, and both predate or overlap the machines above. Neither is usually called a computer because neither executes a sequence of operations autonomously.

The third is the Jacquard loom, demonstrated in 1801. It used punched cards to control weaving patterns, and Babbage borrowed that idea directly for the Analytical Engine. The loom was not a computer, but the control interface that made programmable machines practical came from textile manufacturing, not mathematics.

A counterintuitive detail: the ancient Greeks had the mechanical sophistication to build complex gear trains, yet the technology did not persist. The Roman world produced no comparable surviving device, and the knowledge appears to have died out rather than diffused. The reason is probably economic and social, not technical; precision bronze gearing served a narrow elite need for calendar and eclipse prediction.

Misconceptions worth correcting

Several claims circulate widely and are wrong or misleading.

The Antikythera mechanism was not a clock. It had no escapement, no regular tick, and no timekeeping function. It was a hand-cranked calculator, turned to a chosen date to read out astronomical positions.

Babbage did not finish either engine. Government funding for the Difference Engine was withdrawn in 1842, and the Analytical Engine never progressed past detailed drawings. Credit for the first completed programmable mechanical computer arguably belongs to later machines and to the 1991 reconstruction.

The Analytical Engine was not built, but it was not imaginary either. Its design was specified to a level of detail that later engineers judged buildable with 19th-century machining.

Babbage did not work alone in the way the popular story implies. Ada Lovelace's 1843 notes are the clearest contemporary exposition of the machine's generality, and her algorithm example is a genuine contribution to the design's interpretation.

Comparison: the candidates for "first mechanical computer"

Machine Date Inventor Programmable Completed in its era
Antikythera mechanism c. 150–100 BCE Unknown Greek craftsman No Yes
Astrolabe c. 200 BCE onward Various, unknown No Yes
Pascaline 1642 Blaise Pascal No Yes
Stepped Reckoner 1694 Gottfried Wilhelm Leibniz No Yes
Jacquard loom 1801 Joseph Marie Jacquard Yes, punched cards Yes
Difference Engine 1822 design Charles Babbage No No; built 1991
Analytical Engine 1833 design Charles Babbage Yes, punched cards No

The pattern is clear. Devices that were completed came earlier and were specialized. Devices that were programmable came later and were not completed in their own century.

Timeline: from bronze gears to stored programs

Year Event Significance
c. 150–100 BCE Antikythera mechanism built Earliest known geared astronomical computer
c. 200 BCE–1400s CE Astrolabes and geared calendars across Islamic and European worlds Calculation aids persist; complexity stays modest
1642 Pascal's Pascaline First widely described mechanical arithmetic machine
1694 Leibniz's Stepped Reckoner Multiplication and division by repeated addition
1801 Jacquard loom demonstrated Punched-card control of a machine
1822 Babbage presents Difference Engine First documented design for a mechanical computer with a named inventor
1833 Babbage designs Analytical Engine First design with separate memory and processor
1843 Lovelace publishes her notes First published machine algorithm
1991 Science Museum builds Difference Engine No. 2 Confirms Babbage's design was sound

This timeline is the backbone of the answer. The invention of the mechanical computer is not a single moment; it is a 2,000-year arc from anonymous bronze gearing to a named Victorian design that was never finished.

Practical actions for answering this question accurately

If you need to state the answer in writing, a presentation, or a classroom, these steps keep you accurate.

Decide which question you are answering: earliest surviving mechanical computer, or first designed programmable computer. State the definition before naming a date. Use "c. 150–100 BCE" for the Antikythera mechanism, not a single year. The dating range is the honest figure. Attribute the Antikythera mechanism to unknown craftsmen. Do not assign it to Archimedes or any named individual without hedging. Use 1822 for Babbage's Difference Engine design and 1833 for the Analytical Engine design. Do not say either was built in Babbage's lifetime. Red flag: any source that says Babbage "invented the computer in 1822" is compressing two different machines and two different claims. Red flag: any source that names a single inventor for the Antikythera mechanism is presenting speculation as fact.

The threshold question, restated plainly: if your definition requires a completed machine, the answer is the Antikythera mechanism, anonymously built around 150–100 BCE. If your definition requires a programmable design with a documented inventor, the answer is Charles Babbage in 1833. Reconcile the two by naming both, in that order.

Limitations: what the evidence cannot settle

The Antikythera mechanism's inventor is unrecoverable. No name, no workshop record, and no contemporary description survives. Claims tying it to a specific philosopher are scholarly hypotheses, not findings.

The dating has a real range. The 150–100 BCE window comes from calendar inscriptions and coin evidence in the wreck, not from a signed date. Some scholars place construction earlier within that window; the range is the defensible statement.

Babbage's Analytical Engine was never built, so its status as a "computer" rests on design analysis and on the successful 1991 reconstruction of the simpler Difference Engine. That reconstruction validates the Difference Engine specifically, not the Analytical Engine's more complex control logic.

Finally, the record is biased toward what survived. Bronze corrodes and gets recycled. If other geared calculators existed in the ancient Mediterranean, most would have vanished. The Antikythera mechanism may be the only survivor of a class of devices, not a unique outlier, and no current evidence can distinguish those possibilities.