
The Famous Computer Bug That Was Literally a Moth
The 1947 Harvard Mark II logbook moth is real and well documented, but it did not coin the word "bug" — that predates 1947 by decades, back to Edison.
TL;DR: In September 1947, operators working on the Harvard Mark II relay computer found a moth trapped in one of its relays, taped it into the machine's logbook, and wrote beside it "First actual case of bug being found." The page still exists and is held by the Smithsonian, and Grace Hopper was among those working on the Mark II at the time. Some popular retellings get one part wrong: the claim that this moment coined the words "bug" and "debug." It did not coin "bug," and a 1987 study of the term by Fred Shapiro points to "debug" in a 1945 issue of the Journal of the Royal Aeronautical Society. Engineers had used "bug" to mean a technical fault for decades before 1947, including in Thomas Edison's own correspondence from the 1870s. The Mark II moth is a literal bug on record, a real insect found in a relay and taped into the log, not the first use of the word for one.
The moth in the Harvard Mark II logbook
The Harvard Mark II was an electromechanical relay computer, and like any machine built from mechanical relays, it was vulnerable to anything that could physically obstruct a moving part. In September 1947, operators found a moth trapped between the contacts of one of its relays (Relay #70, Panel F).
They removed the moth, taped it into the machine's logbook, and wrote a short note beside it: "First actual case of bug being found." The page survives to this day and is held in the collection of the Smithsonian National Museum of American History, which is part of why this particular anecdote, unlike so much computing folklore, comes with physical evidence attached rather than resting on secondhand memory.
The fact-check: "bug" did not start here
A detail that some retellings lose is that "bug," used to mean a fault or defect in a piece of engineering, was already an established figure of speech well before 1947. Thomas Edison used the word this way in his own correspondence in the 1870s, describing the glitches and unexpected failures that turned up while he was developing his inventions. The word stayed in technical use after that: the Oxford English Dictionary cites an 1889 Pall Mall Gazette report that Edison had spent two nights discovering a "bug" in his phonograph, and Webster's 1934 dictionary defined a bug as "a defect in an apparatus or its operation."
That earlier history matters because it changes what the logbook entry can possibly mean. If "bug" already meant a fault to any engineer reading that page in 1947, then the note "First actual case of bug being found" is not introducing a new term. It is making a joke, one that depends entirely on the word already being familiar: for once, the "bug" causing trouble was an actual insect, not a figure of speech.
What the moth really is: a literal, documented bug
Strip away the coining myth and what remains is still a genuinely interesting, well-documented fact: this is a well-known early case of an actual insect found inside a computer, with a physical record made of the moment. That is a narrower claim than "the origin of the word bug," and it is the accurate one.
The distinction is small in wording and large in meaning. "A literal bug, recorded in the log" is a specific, checkable historical fact with an artifact to prove it. "First use of the word bug for a computing fault" is a claim about language history, and it is simply false, since the word predates the incident by generations. Most of what makes this story worth telling at all is that a long-standing metaphor briefly, and memorably, became literal.
Why the (partly wrong) legend endures
Part of the story's staying power is that it comes with an artifact you can point to and photograph. Much of what happens inside a computer is logical or electrical, invisible by nature. A moth taped to a page, with a handwritten joke beside it, is tangible in a way that logic and electrical signals are not.
Grace Hopper was present, and she later made the incident famous in her many public lectures, as the Computer History Museum puts it. The log's own wording, "First actual case," already treats the word as familiar. But as the anecdote passed through popular science writing and technology folklore over the following decades, it was sometimes compressed into a cleaner and less accurate version: that this is simply where "bug" and "debug" came from, full stop.
What "debugging" actually owes to the Mark II team
There is a real, if more modest, claim buried underneath the exaggerated one. While "bug" itself predates 1947, the Smithsonian's National Museum of American History says Hopper and the rest of the Mark II team helped popularize the term "computer bug" and the related phrase "debug," and that both words soon became a standard part of the language of computer programmers.
The fair way to describe the Mark II moth's place in history is that it is a well-known, physically documented instance of an engineering term for faults that people working on the first computers were already using. That is still worth telling. It is not an origin point for the word itself.
A short timeline of "bug" and "debugging"
| Period | Milestone | What it was |
|---|---|---|
| 1870s | "Bug" as engineering slang | Thomas Edison and contemporaries used "bug" to describe unexpected faults in mechanical and electrical inventions |
| 1880s to 1930s | Continued technical use | An 1889 newspaper report has Edison hunting a "bug" in his phonograph, and Webster's 1934 dictionary defines a bug as a defect in an apparatus or its operation |
| September 1947 | The Harvard Mark II moth | Operators found and taped an actual moth into the machine's logbook, noting "First actual case of bug being found" |
| Following decades | "Debugging" standardizes in computing | The term for locating and removing computing faults becomes the field's standard usage, helped along by Hopper and the Mark II team |
| Ongoing | The legend spreads | The moth story circulates widely, sometimes with the claim attached that it coined "bug" and "debug," though "bug" was already decades old |
The table keeps the two histories separate: when the word already existed, and when the specific, documented, literal incident happened. Placed side by side, the sequence makes clear that the moth could only be a joke about an existing term, not the birth of one.