The earliest known programmable machine was built by the 12th-century Arab engineer al-Jazari, who created a musical automaton with a drum machine that could be reprogrammed to play different rhythms. But the answer depends on how strictly you define “programmed machine,” and the history stretches across several centuries, with each inventor building on what came before.
Al-Jazari’s Programmable Drum Machine
Around 1206, the polymath al-Jazari designed a remarkable device: a boat carrying four mechanical musicians that floated on a lake to entertain guests at royal drinking parties. The key innovation was a drum machine that used small pegs, similar to the bumps on a music box cylinder, to trigger levers connected to the percussion instruments. By physically moving those pegs to different positions, the operator could change the rhythms and drum patterns the machine played. That ability to reconfigure the output without rebuilding the machine is what separates a programmable device from a simple automated one.
Professor Noel Sharkey of the University of Sheffield has argued that this mechanism qualifies as the first recorded programmable automaton and produced a working reconstruction of how it likely functioned. The distinction matters: a water clock or a wind-up toy performs the same action every time, locked into fixed behavior. Al-Jazari’s machine could be reprogrammed for each new performance.
From Pegs to Punched Paper
The next major leap came in 1725, when French silk weaver Basile Bouchon invented a paper tape with punched holes to automate the operation of a loom. Each hole (or absence of a hole) told the loom whether to raise or lower a particular thread. This was the first time perforated paper served as a set of instructions for a machine, a concept that would prove extraordinarily durable.
Bouchon’s idea was refined over the following decades, but it reached its full potential in 1801 with Joseph Marie Jacquard’s loom. Jacquard replaced Bouchon’s single strip of paper with a chain of sturdy punched cards. Each card controlled one pass of the shuttle, and by stringing different cards together, a weaver could produce enormously complex patterns automatically. The system functioned like a form of read-only memory: the pattern existed on the cards, and the loom simply followed the instructions. Textile manufacturers adopted it widely because it let them store and reproduce intricate designs without relying on the skill (or memory) of an individual weaver.
Babbage and the Analytical Engine
Charles Babbage saw the Jacquard loom and recognized that the same principle could control a calculating machine. In the 1830s, he designed the Analytical Engine, a mechanical computer that would use punched cards to receive instructions. The machine was never fully built during his lifetime, but its design included features that are now fundamental to computing: a processing unit, a memory store, and the ability to branch, meaning the machine could skip ahead or loop back in its instructions depending on intermediate results.
Babbage’s collaborator Ada Lovelace wrote what many historians consider the first computer program. In a document known as Note G, she laid out a detailed algorithm, a step-by-step sequence of operations, for computing a series of numbers called Bernoulli numbers. Scholars have debated whether calling Lovelace “the first computer programmer” is fully accurate, since Babbage himself sketched out programs for the engine. But a 2023 analysis published on arXiv affirmed that Lovelace created “an elemental sequence of instructions” for processing by a machine, which is, at its core, what a program is.
Punched Cards Enter the Modern World
The leap from mechanical looms to data processing happened through Herman Hollerith. In 1888, the U.S. Census Bureau held a competition to find a faster way to tabulate census results, and Hollerith won the contract for the 1890 census with an electromechanical system built around punched cards. Each card represented one person’s census responses: race, gender, citizenship, age, and other categories. A reader pressed metal pins against the card, and wherever a hole had been punched, the pin passed through and made contact with a pool of mercury beneath, completing an electrical circuit. That circuit advanced a counting dial by one tick.
Hollerith’s machine was not programmable in the way Babbage envisioned. It read data, not instructions. But it cemented punched cards as the dominant medium for storing and processing information, a role they would hold well into the 1970s. Hollerith went on to found the company that eventually became IBM.
Why the Answer Depends on Definitions
The core distinction historians use is the difference between fixed automation and programmable automation. A fixed automated machine performs one task repeatedly with no flexibility. A programmable machine can be reconfigured to handle different tasks, and the reconfiguration happens through some kind of external instruction set rather than a physical rebuild.
By that standard, al-Jazari’s peg-based drum machine is the earliest known example: moving the pegs changed the output. Bouchon and Jacquard introduced a more sophisticated idea, encoding instructions on a separate, swappable medium (paper and cards). Babbage and Lovelace took it further still, designing a system where the instructions could include logic, letting the machine make decisions during execution. Each step was genuinely new, and each inventor saw possibilities the previous one had not.
If you are looking for a single name, al-Jazari holds the strongest claim to the earliest programmable machine. If you mean the earliest machine programmed in the modern computing sense, with stored instructions and conditional logic, that credit belongs to Babbage’s design and Lovelace’s algorithm, even though the Analytical Engine was never completed.

