The first computer bug was a literal moth, pulled out of a relay in a Harvard computer in 1947 and taped into the logbook with the note “first actual case of bug being found” — and the logbook is still preserved at the Smithsonian

The first computer bug was a literal moth, pulled out of a relay in a Harvard computer in 1947 and taped into the logbook with the note “first actual case of bug being found” — and the logbook is still preserved at the Smithsonian Featured Image

At 3:45 in the afternoon on September 9, 1947, a team of engineers working on the Harvard Mark II computer were trying to figure out why the machine was malfunctioning.

The Mark II was a beast — an electromechanical computer the size of a room, built for the United States Navy, full of thousands of mechanical relays that clicked open and closed to perform calculations. When something went wrong, you couldn’t check the code. You had to physically inspect the hardware.

Inside Relay #70, Panel F, the engineers found their problem.

A moth. A dead one. Stuck between the relay contacts, exactly where it shouldn’t be, preventing the relay from closing properly. They removed it. The machine started working again.

What happened next is why we remember the story.

Somebody on the team taped the moth into the official logbook. Underneath it, they wrote: 15:45 Relay #70 Panel F (moth) in relay. First actual case of bug being found.

That logbook page, with the moth still taped to it after seventy-eight years, is one of the most quietly funny artefacts in the history of computing. It’s currently held at the Smithsonian’s National Museum of American History.

Why the note is funnier than people realise

The story is usually told as if this incident is where the word bug came from in computing. It isn’t.

Engineers had been calling glitches “bugs” for at least sixty years before this moth turned up. The Oxford English Dictionary traces the engineering use of bug back to the 1870s. Thomas Edison wrote about “bugs” in his inventions in an 1878 letter, complaining that getting a new invention working required hunting down all the little bugs inside it.

By 1947, calling a hardware fault a bug was completely standard engineering slang.

Which is what makes the logbook note so good. First actual case of bug being found — emphasis on actual — is a deadpan joke. The engineers had been calling abstract glitches “bugs” for decades, and now, for the first time, they had a literal bug to point at. The joke only lands if you know the word was already in heavy use.

The moth didn’t invent the word. The moth made fun of the word, by being an unusually literal example of it.

That’s why somebody bothered to tape it into the logbook. They thought it was funny.

Why this entry survived when nothing else did

Computer engineering teams keep logbooks. Most of those logbooks are stunningly boring — line after line of timestamps and error codes from operators on different shifts.

The Mark II logbook from 1947 is not stunningly boring. It’s a working record of a team building one of the first programmable electronic computers, full of the day-to-day frustrations of getting an enormously complex new machine to behave. And in the middle of it, on the page dated September 9, somebody taped a moth.

The page got passed down because of the joke. It got photographed because of the joke. It got preserved because of the joke. Without the moth, it would have been one more line of 1940s computer maintenance. With the moth, it became the most photographed page in the entire history of early computing.

How Grace Hopper became attached to the story

The other thing the popular retelling usually gets wrong is who actually found the moth.

Grace Hopper was on the Mark II team in 1947. She was already a remarkable mathematician and would later become a Navy rear admiral and one of the most important figures in the history of computer programming. But the September 9 logbook entry doesn’t appear to have been written by her, and she may not have been the person who actually pulled the moth out of the relay.

What Hopper did, decades later, was tell the story. She told it brilliantly. Through years of lectures and interviews, she made both the incident and the moth-as-bug joke famous until the story became inseparable from her name.

That’s how a lot of historical anecdotes work. The person who lived the moment isn’t always the one who immortalises it. Hopper didn’t claim credit for finding the moth — she was careful about that. But she made sure the rest of the world knew the moth had existed, and what the joke meant.

What you can actually see at the Smithsonian

The logbook isn’t always on public display. It’s part of the National Museum of American History’s collection and gets rotated in and out of exhibitions on the history of computing.

When it is on display, it’s exactly what you’d hope for. A worn page from a 1940s engineering notebook. A small dead moth, taped neatly into place. And underneath, in the handwriting of an engineer who has now been dead for decades, a joke that’s still funny.

The moth itself is roughly two inches across. Grey and brown. It looks, frankly, like any moth that might fly into your kitchen tonight.

The fact that this one happened to fly into the wrong relay at the wrong time, in a room full of engineers with a sense of humour, is the reason millions of people in 2026 still use the word debug without quite knowing where it comes from.

The actual bug is still there. In a drawer in Washington. Almost eighty years old. The most successful insect in the history of computing.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Make Tech Easier Editorial Team Avatar

Read next

The Roman aqueduct at Segovia, built around the first century AD without mortar, still carried water into the 1970s, its 167 granite arches held together by nothing but the precise weight distribution of stones cut to fit each other within fractions of a millimeter.
In 1843, Ada Lovelace described a brass-and-punched-card engine that could act on symbols as well as numbers, even composing music if harmony could be reduced to rules, inside seven translator’s notes three times longer than the paper itself
ARPANET sent its first message on 29 October 1969 from a lab at UCLA to a machine at Stanford, and the message was supposed to read ‘LOGIN’ — but the system crashed after the L and the O, meaning the first word ever transmitted over the network that became the internet was, by accident, ‘LO’.
In 1995, Microsoft shipped a cartoon-house interface called Bob, led by Melinda French, who married Bill Gates while it was in development — it demanded twice the memory of a typical home PC, sold roughly 30,000 copies, and was dead within a year, leaving behind the font Comic Sans and the animated assistant that became Clippy.
Apple’s original 1984 Macintosh keyboard had no arrow keys, no function keys, and no numeric pad because Steve Jobs wanted users to reach for the mouse first. Then Apple quietly sold the missing keys as an accessory.
In 1965, Mary Allen Wilkes wrote LAP6 for the LINC computer from her parents’ Baltimore home, testing an interactive operating system on a 250-pound machine in the living room and becoming the first known person to use a personal computer at home, twelve years before the Apple II reached buyers
In 1969, László Bélády and two IBM colleagues published a paging-machine anomaly showing FIFO could make four memory frames suffer ten page faults after three frames suffered nine, leaving generations of operating-systems students staring at the moment more memory became the wrong answer
In 1964, IBM risked its entire corporate empire on the System/360, a chaotic gamble to make all of its future machines compatible with the same software — and the architecture proved so robust that modern enterprise mainframes today are still running sections of binary code written more than sixty years ago