Where the Word "Bug" Came From — The Story of the First Computer Bug
When a program behaves strangely, we often say “there’s a bug.” Whether or not you write code, this word has become an everyday term that everyone uses. But why, of all things, did “bug,” a word for an insect, come to mean a software error?
There is a famous story here that features a real moth. And that story hides a twist that many people don’t know about. Today, let’s follow this short and fun tale about the word’s origin.
1947: A Moth Is Found Inside a Computer #
On September 9, 1947, Harvard University in the United States had a giant computer called the Mark II. It was nothing like the computers we use today. It was big enough to fill an entire room, and it was a machine that ran calculations through countless electromagnetic relays clicking away.
But that day, the machine behaved strangely. The technicians who tried to find the cause discovered something unexpected at relay #70, Panel F. A real moth was stuck between the contacts. With an insect lodged where electrical signals were supposed to pass, the machine couldn’t possibly work properly.
The Moth Taped Into the Logbook #
This is where the reason this incident became legendary comes in. After the technicians removed the moth, they didn’t just throw it away. They taped the moth into the logbook, their work journal, and wrote this down.
“First actual case of bug being found.”
There’s a joke in this short note. The technicians were already calling defects in the machine “bugs.” But this time it wasn’t a metaphor — a real insect had literally turned up. So they showed some wit, as if to say, “This time we found a real bug.”
This logbook is still kept at the Smithsonian Institution in the United States. The page with the moth on it remains intact. You could call it the most famous insect in computer history.
How Does Grace Hopper Enter the Story? #
This story almost always comes with the name Grace Hopper attached. Hopper was one of the most notable figures in the early history of computing. She was a mathematician and programmer who later rose to the rank of rear admiral in the U.S. Navy, and she was a member of the team that worked on the Mark II.
There is one point worth clearing up, though. It’s commonly said that “Hopper found the moth,” but it’s hard to treat that as fact. There’s no clear evidence that Hopper herself wrote the logbook entry. It’s more accurate to say that Hopper and the entire Mark II team enjoyed telling this story, and in doing so spread the terms “bug” and “debug” far and wide.
So Hopper was less the person who coined the word and more an evangelist who made this story famous.
Actually, “Bug” Existed Before That #
Now for the real fun point of this post. Many people believe that “the word bug was born from the 1947 moth incident,” but this is not true.
Using “bug” to mean a defect in a machine or device goes back much further. The inventor Thomas Edison is a prime example. As early as the 1870s, he was already calling the small defects and faults that arose during the invention process “bugs.” In a letter he wrote in 1878, he even joked that he had found a “bug” in one of his devices.
In other words, by the time the moth incident happened in 1947, engineers had already been calling defects “bugs” for decades. This is exactly why the logbook’s note, “First actual case of bug being found,” reads as a joke. A word they normally used only as a metaphor had this time shown up as a real insect.
So to be precise, the moth incident was not the event that created the word “bug.” It was an anecdote that symbolically etched an already existing expression into the history of computing. Rather than the birth of the word, it’s a scene that shows the moment the word crossed over into the world of computers.
The Word “Debug” Took Hold Here Too #
We call the work of catching errors “debugging.” Since “de-” means to remove something, “debug” literally means to take out the bugs.
The very act of removing the moth from the relay was the most literal debugging there ever was. As “bug” took hold in the computing field, the companion word “debug” naturally settled in as well, and it’s still used as everyday language by every developer today.
If you’re curious about the early figures in computer history and the culture they left behind, I recommend also reading What Is a Hacker. The point that even a single word carries people’s stories holds true in that post as well.
Wrapping Up #
To sum up: the word “bug” wasn’t born from the 1947 moth incident. It was an expression engineers had used to describe defects for decades before that. But when a real moth was found in Harvard’s Mark II and that moth was taped into the logbook, the word was left as an unforgettable symbol in computer history.
If you find yourself sighing over a bug today, try picturing that single moth stuck between the relays 70 years ago. At least your bug won’t need a pair of tweezers to remove.