Skip to main content

The First Computer Bug Was a Literal Moth

In 1947, engineers taped a dead moth into the Harvard Mark II logbook as the first actual case of bug being found. Here is the true story behind the word.

By FactSpire Editorial6 min read
Moth trapped in vintage computer relay contacts, 1947 laboratory

Key takeaways

  • On September 9, 1947, Harvard Mark II operators found a two-inch moth wedged in Relay 70 of Panel F and taped it into the logbook as the "first actual case of bug being found."
  • The moth did not name the bug: Thomas Edison used "bug" for technical glitches in 1878, and Mark II operators already used it for relay faults in 1944.
  • The logbook entry was engineer humor — a pun that only lands because everyone in the room already called defects "bugs".
  • Grace Hopper popularized the story but did not find the moth or coin the term; the moth-taped logbook page is preserved at the Smithsonian.

Every bug you have ever cursed traces back to a moth. On September 9, 1947, at 3:45 in the afternoon, the operators of the Harvard Mark II Aiken Relay Calculator were chasing a machine malfunction when they opened Panel F and found the culprit wedged between the contacts of Relay 70: a two-inch moth, dead. They removed it with tweezers, taped the specimen into the daily logbook with a roll of adhesive tape, and wrote the line that would outlive every one of them: "first actual case of bug being found." That logbook page, moth and all, is now preserved at the Smithsonian's National Museum of American History.

How a moth broke a room-sized calculator

The Harvard Mark II was an electromechanical machine, a room-sized beast of roughly 13,000 relays — tiny electrically switched contacts that clicked open and shut to perform arithmetic at about eight cycles per second. Each relay was a physical switch: an electromagnetic coil pulled a metal armature, contacts met, and current flowed. When the moth lodged itself between the contacts of Relay 70 in Panel F, the armature could not close properly, and the arithmetic that depended on that relay produced wrong results or halted the machine entirely. The operators were running test sequences that afternoon in Cambridge, Massachusetts, when the Mark II misbehaved. Tracing the fault through thousands of identical relays by hand sounds impossible, but the machine's dual checking circuit — a built-in verification mechanism that recomputed results through a second set of hardware — flagged the discrepancy and halted the calculator, narrowing the hunt. Operator William "Bill" Burke opened the right panel and found the insect. It is worth remembering what debugging looked like before software existed: you walked up to the machine, opened a steel panel, and looked for something physical.

Advertisement

To appreciate how remarkable it was to isolate one insect among 13,000 relays, consider the scale of early computing. The Mark II's famous contemporary, ENIAC, ran on vacuum tubes rather than relays but demanded the same physical style of troubleshooting — technicians hunted burned-out tubes across acres of panels. These machines were so vast and so new that folklore felt inevitable, the way other accidental milestones of the era, like the microwave oven's accidental invention, have their own origin myths. The moth story belongs to a long tradition of computing lore, from the QWERTY keyboard's history to the impossible-bug war stories programmers still trade today — small human moments that make strange new technology feel touchable.

The engineers were making a pun

Here is the twist most tellings leave out. The word "bug" did not enter engineering because of this moth. It was already a century old. Thomas Edison used "bug" to mean a technical glitch in 1878, writing about the "little faults and difficulties" that plagued his work, and the term circulated through telegraph offices, telephone exchanges, and early radio workshops long before it reached computers. The operators of the Mark II even used "bug" for relay glitches on the earlier Harvard Mark I back in 1944. That is precisely why the logbook entry is funny. Nobody was coining a term; they were making a pun that only lands if everyone in the room already uses "bug" to mean a defect. "First actual case of bug being found" is engineer humor — a literal bug in a machine everyone had been calling "buggy" for years. The moth did not name the bug. In a sense, the bug named the moth.

How the story became Grace Hopper's

If one person turned this incident into legend, it was Grace Hopper. She was present on the Mark II team as a Navy reserve officer and mathematician, and she spent the next four decades retelling the story in lectures, on television, and to admirals — until it became computing's founding parable. By the time she retired as a rear admiral, the moth had become shorthand for the whole idea of debugging, and Hopper herself was widely (and wrongly) credited with finding the insect, taping it in, and coining the term.

Advertisement

She did none of those things, though the myth is understandable: Hopper genuinely was one of the most important figures in early computing — she built the first compiler, the A-0 System, in 1952 and helped shape COBOL — so the moth story naturally gravitated toward the brightest name in the room. The real story is more honest and more charming: a team of night-shift engineers, windows left open on a warm September evening, a moth drawn in by the machine's heat and lights, and a joke preserved in adhesive tape that they never expected anyone outside the lab to read.

The myth got the etymology backwards — and that matters

Correcting the moth story is not pedantry; it reveals how technical folklore actually forms. The popular version says the moth incident created the word bug. The truth is nearly the reverse: an existing slang word turned a mundane lab mishap into an irresistible pun, Hopper's decades of retelling amplified it, and each retelling sanded off a little more context until only the punchline survived. Ideas do not spread because they are accurate — they spread because they are sticky, and a literal insect in the world's most important machine is maximally sticky. Yet the artifact itself is real and checkable: the logbook page exists, the moth is still taped to it, and the Naval History and Heritage Command photograph of the page is public. Few myths get to keep their evidence. This one does. The moth also marks a hinge point in how humans relate to machines. The Mark II's relays were visible and touchable — you could find a bug with tweezers. Within a generation, computers became sealed silicon, and bugs became invisible: misplaced semicolons, race conditions, off-by-one errors. Debugging changed from a physical search into a mental one, but the word stayed, and so did the ritual of naming a mysterious failure after something small, stubborn, and hard to see. The next time a program crashes and you say you are "debugging" it, you are quoting a pun made by tired engineers in 1947 — a joke about a moth that wandered into a relay and accidentally became the most famous insect in technology. That is the real story, and it is better than the myth: nobody coined anything that afternoon. They just taped a moth to a page, laughed, and went back to work. The rest of the century did the rest.

Advertisement

Frequently asked questions

Did the moth incident create the word "bug"?

No. The term was already a century old — Edison used it in 1878 — and operators had used it for relay glitches since 1944. The 1947 logbook entry was a pun, not a coinage.

Did Grace Hopper find the moth?

No. Operator William "Bill" Burke found the insect. Hopper, a Navy reserve officer on the Mark II team, popularized the story over decades of retelling and is wrongly credited with finding it and coining the term.

Where is the original moth logbook page?

The logbook page, moth still taped to it, is preserved at the Smithsonian's National Museum of American History.