● A free public tool  ·  Built by Poptani Labs  ·  No sign-up  ·  Your data never leaves your browser
The Butterfly Effect · 5-minute read

The moth that gave computers the word 'bug'

Bird-cherry ermine moth caterpillars clustered on a branch
Image: 'Bird-cherry ermine moth (Yponomeuta evonymella) caterpillars.jpg' by Charles J. Sharp, CC BY-SA 4.0, via Wikimedia Commons

Every programmer in the world talks about bugs. They hunt them, squash them, file them, and spend entire careers debugging — and the word comes from a moth. On 9 September 1947, engineers working on the Harvard Mark II, an electromechanical computer built under Howard Aiken at Harvard University, traced a fault in the machine to a moth trapped between the contacts of one of its relays. Somebody removed the insect, taped it into the logbook, and wrote underneath: "First actual case of bug being found." The logbook, moth and all, is now in the Smithsonian's National Museum of American History. It is the most famous dead insect in the history of technology — and the story behind it is both funnier and more interesting than the version most people have heard.

The machine the moth stopped

The Mark II — also called the Aiken Relay Calculator — was a serious piece of military hardware. Completed in 1947 and financed by the United States Navy, it weighed 25 tons, filled more than 4,000 square feet of floor space, and was built to do ballistic calculations for the Naval Proving Ground at Dahlgren, Virginia. It used high-speed electromagnetic relays instead of the counters in its predecessor, the Mark I, making it roughly two and a half times faster at addition and eight times faster at multiplication. It was also built with redundancy in mind: the machine was really two sub-computers that could work together or separately, cross-checking each other's results. Among the people building and programming it were Edmund Berkeley and Grace Hopper, a mathematician and Navy officer who would become one of the most famous names in computing. On 9 September 1947, while the machine was still being debugged at Harvard before delivery to the Navy, a relay misbehaved. The operators opened the machine up and found the cause: a moth, about two inches across, wedged between the relay contacts, stopping them from closing.

The fun anecdote: the word was already old

Here is the part the popular version gets wrong. The moth did not invent the word "bug." Engineers had been calling faults "bugs" for decades — Thomas Edison used the word for glitches in his inventions in the 1870s, and it was standard slang in engineering long before 1947. That is exactly what makes the logbook entry a joke: the team already called faults bugs, and now, for the first time, they had found a literal one. Grace Hopper, who was on the team, loved the story and retold it in lectures for the rest of her life, which is how it spread — and how she came to be credited, wrongly, with coining the term. The Smithsonian, which holds the logbook, notes that it was probably not even Hopper's logbook. She did not find the moth, did not coin the word, and did not write the entry. What she did was recognise a perfect story and tell it brilliantly, for decades, until the whole industry believed it. The moth's real achievement was different: it gave the industry the word "debugging." If faults were bugs, then finding them was debugging — and that word, unlike "bug," really did take off from this incident. The moth is still there, taped to the page, nearly eighty years later.

Why one moth changed the language

The reason the story stuck is that the metaphor was already perfect. A bug is small, hidden, hard to find, and capable of stopping something enormous — which is precisely what a software fault is. The Mark II weighed 25 tons and was stopped by an insect weighing a fraction of a gram. That ratio — a tiny cause, a huge consequence — is the whole history of computing in miniature. It is also why "debugging" became the name of the job rather than a joke about it: the work of programming turned out to be, more than anything else, the work of finding the small thing that is wrong. Hopper herself went on to build the first compiler, the program that translates human-readable code into machine instructions, and to champion the idea that computers should be programmed in something close to English. But her most durable contribution to the language of computing may be the one she only popularised: a dead moth, taped into a logbook, that turned an engineer's joke into the word every programmer uses a hundred times a day.

The Lesson

The lesson of the moth is not that insects cause computer faults — although, in 1947, one did. It is that a small, hidden cause can stop an enormous machine, and that the words we use to describe a problem shape how we think about solving it. Engineers already called faults bugs; the moth made the metaphor literal, and Hopper made it famous. Every time a programmer says they are debugging, they are quoting a joke written under a taped-down moth in a Harvard logbook, on 9 September 1947.

Related on Poptani Labs: The missing hyphen that blew up a rocket to Venus, The $327 million mix-up: how a metric error lost a Mars orbiter, The mouldy dish that saved millions: how penicillin was found by accident. More in this category: The Butterfly Effect.

Sources: Log Book With Computer Bug (Smithsonian National Museum of American History), September 9: First Instance of Actual Computer Bug Being Found (Computer History Museum), The Bug in the Computer Bug Story (JSTOR Daily)

← All posts