Korva
Space

Margaret Hamilton Wrote the Moon Landing Code in a Stack Nearly as Tall as She Was

She led the team behind Apollo's onboard code, helped popularize the term software engineering, and worked on computers with a fraction of a phone's power.

AI image
The Headlines · A Forced Retreat for Trump and Hegseth, and What to Know About the Russia Plague Scare

In the photograph, Margaret Hamilton stands beside a tower of paper that nearly tops her head.

The stack is the printed-out programs behind the lunar flight, page after page of instructions that would guide astronauts to the surface of the moon and bring them home again.

Hamilton, a young mathematician who joined the Apollo program in the 1960s, directed the group that created much of that flight software. She also helped popularize the term software engineering, insisting that writing programs for a spacecraft demanded the same rigor as building its hull and engines.

The rigor had to work with tools that now seem almost handmade. Apollo software was stored in the spacecraft computer using hand-woven copper wires. The computer on board the lunar lander, the small craft that touched the moon, held so little data that a modern iPhone can store about 7 million times as much.

Hamilton later recalled how narrow her focus had been during those years. She was not thinking day to day about history or heroism. “I was not concentrating on the mission per se. I was concentrating on the software,” she said, laughing. Then Apollo 11 succeeded, and the scale of it reached her. “My God, look what happened. We did it. It worked.”

The work did not stop with one landing. Hamilton went on to contribute to later lunar missions, and her programming fed into America’s first orbiting station and the first drafts of the reusable shuttle, the spacecraft that carried crews into orbit for three decades.

To honor her major role in American science, Barack Obama, the former president, presented her with the Presidential Medal of Freedom, the nation’s highest civilian honor. Hamilton, who died at 90, also received a different kind of tribute when Lego, the Danish toy company, released a tiny Hamilton figure sold with its own tiny, teetering stack of code.

Questions people ask

What did that tall stack of code actually do?

It ran the Apollo Guidance Computer, which handled navigation, steering, and timing for the trip to the moon and back. During the Apollo 11 landing, Hamilton's software prioritized the most critical tasks and kept flying when the computer was overloaded. That judgment call is a major reason the landing succeeded.

Why did she insist on the phrase 'software engineering'?

In the 1960s, software was often treated as secondary to hardware and written without formal testing or rules. Hamilton used the term to argue that code for life-or-death missions should be designed, tested, and managed like an engineering discipline. The phrase caught on and is now standard across the industry.

How did a computer with so little memory land on the moon?

The Apollo computer did very few things, but it did them extremely reliably and at exactly the right time. Astronauts and ground controllers handled much of the judgment, while the computer managed precise calculations for speed, position, and fuel. Tight, efficient code made up for the tiny memory.