← Codes you can try

How the Enigma Machine Worked

A machine that scrambled every letter differently each time a key was pressed.

This page has a working Enigma I that you can type on. Everything runs in your browser. Nothing you type is sent or kept.

I The idea

The idea

Enigma looked like a typewriter with a board of lamps above the keys. An operator pressed a letter key, and a different letter lit up on the lamp board. The operator sent the lamp letters by radio.

Press the same key again and a different letter lights up. That is because the machine changes a little with every key press. Inside, three wheels called rotors turn, so the scrambling is new each time.

Germany’s military used it from the 1920s. Its makers thought it could not be broken. It was broken, and this page shows how it worked and where the weak spot was.

II The machine

Try the machine

Follow the steps from 1 to 7. The page opens with a short message already typed, so you can see a result. Change any setting and the whole message is worked out again with the new setting.

The Enigma machine

1. Choose three rotors

The box held five rotors, numbered I to V. Pick three different ones. The left rotor is the slowest. The right rotor turns on every key press.

Reflector: B. It is a fixed wheel at the end that sends the signal back through the rotors.

2. Set the rings

Each rotor has a ring with the alphabet on it. The ring setting turns the ring against the wiring inside.

3. Set the start positions

These are the letters showing in the three windows before any key is pressed.

Each cable swaps two letters before and after the rotors. Type up to 10 pairs, like AB CD EF. Each letter can go in just one pair.

5. Type your message. Tap the keys below, or type on your keyboard after clicking away from the boxes and menus. Each press turns the rotors and lights one lamp.

LEFTA
MIDDLEA
RIGHTA

6. Read the output. The lamp letters are in groups of five, as operators sent them.

What was typed

What the lamps showed (the output)

Press a key to see the path the signal takes.
Show the path in words

    7. Decrypt it. Set the machine back to the same start positions, type the output, and the original message comes back.

    III Inside

    What happens when you press a key

    The picture above follows one key press from start to finish. The signal passes through the plugboard, the three rotors, the reflector, back through the three rotors, and the plugboard again. Then it reaches a lamp.

    Each rotor is a wheel with 26 contacts on each side. Wires inside join the contacts in a scrambled order. Each of the five rotors has its own wiring. A rotor also has a notch. When a rotor turns past its notch, it moves the rotor to its left along by one.

    The right rotor turns on every key press. The middle rotor turns once for every 26 turns of the right rotor, and the left one much less often. There is one odd detail: when the middle rotor sits on its own notch, it turns on two presses in a row, and it takes the left rotor with it. This is called the double step.

    The rotors turn before the signal moves. So when you press a key, the windows change at once, and the new letters are the positions used for that key.

    Show the rotor wirings and notches

    Each row lists what each letter A to Z becomes on its way in. The notch letter is the one showing in the window when the rotor moves its neighbour along.

    The five rotors
    RotorA to Z becomesNotch
    IEKMFLGDQVZNTOWYHXUSPAIBRCJQ
    IIAJDKSIRUXBLHWTMCQGZNPYFVOEE
    IIIBDFHJLCPRTXVZNYEIWGAKMUSQOV
    IVESOVPZJAYQUIRHXLNFTGKDCMWBJ
    VVZBRGITYUPSDNHLXAWMJQOFECKZ

    Reflector B: YRUHQSLDPXNGOKMIEBFZCWVJAT

    IV Both ways

    Why the same settings both lock and unlock

    The reflector sends the signal back through the rotors by a different route. It also swaps letters in pairs: if the machine turns A into B at one position, it turns B into A at the same position.

    So if the receiver sets the same rotors, rings, start positions and cables, and types the scrambled letters, the lamps show the original message. There was no separate setting for decoding. Step 7 above does exactly this.

    V The flaw

    A letter never becomes itself

    The reflector sends the signal back through the rotors, but never on the contact it came in on. So the machine could never turn a letter into itself. An A could become any letter except A.

    That looks harmless, but it was a weak spot. Pick a letter, and the page presses it 26 times with your settings.

    The lamps that lit

    Codebreakers used this. They could often guess a word that was likely to be in a message, such as WEATHER. A guessed word is called a crib.

    They slid the crib along the scrambled text. If any letter of the crib matched the scrambled letter under it, that place was ruled out, because a letter never becomes itself. Fewer places were left to test.

    Here is the message from the example, sent as scrambled text, with the crib WEATHER slid along it:

      VI History

      A little history

      Arthur Scherbius, a German engineer, applied for a patent on a rotor cipher machine in February 1918. His company began selling it as Enigma in 1923. The idea of the reflector came from his colleague Willi Korn.

      The German navy used Enigma from about 1926, and the army followed within a few years. In 1935 the air force adopted the version used by all of Germany’s armed forces. Sources give different years for when the army began, so this page does not name one.

      The Polish Cipher Bureau broke it. In late 1932 a mathematician at the Bureau, Marian Rejewski, worked out the wiring of the rotors, helped by German documents that French intelligence had passed on. With Jerzy Różycki and Henryk Zygalski he went on to read German messages from 1933.

      In July 1939 the Poles shared their work with British and French codebreakers at a meeting near Warsaw.

      At Bletchley Park in Britain, Alan Turing designed a machine called the Bombe in 1939. The Bombe called Victory went into service in March 1940. Later in 1940 Gordon Welchman improved the design with a part called the diagonal board. The Bombe tested possible settings far faster than people could.

      Sources give two or three different dates for the meeting near Warsaw (25 and 26 July, 26 and 27 July, or 26 July), so this page says just July 1939. They also give different days in March 1940 for the Bombe called Victory, so it says March.

      1. February 1918A patentArthur Scherbius, a German engineer, applies for a patent on a rotor cipher machine.
      2. 1923On saleHis company starts selling the machine as Enigma.
      3. About 1926 to 1935The military adopts itThe German navy starts using Enigma about 1926, the army follows within a few years, and the air force adopts the version used by all of Germany’s armed forces in 1935.
      4. Late 1932Poland breaks itMarian Rejewski of the Polish Cipher Bureau works out the wiring of the rotors, helped by German documents that French intelligence had passed on. With Jerzy Różycki and Henryk Zygalski he reads German messages from 1933.
      5. July 1939Sharing the workThe Poles share what they know with British and French codebreakers at a meeting near Warsaw.
      6. 1939 and 1940The BombeAt Bletchley Park, Alan Turing designs the Bombe in 1939. The Bombe called Victory goes into service in March 1940, and later that year Gordon Welchman improves the design.
      The same story as a timeline, drawn in code.

      VII Keep going

      Keep going

      Try the other pages in Codes you can try, such as the Vigenère cipher.

      VIII Sources

      Sources

      The wirings, notches and reflector B were checked against five pages that agree. They are Crypto Museum, “Enigma wiring” (opens in a new tab), and Dirk Rijmenants, “Enigma technical details” (opens in a new tab).

      The others are Wikipedia, “Enigma rotor details” (opens in a new tab), and Tony Sale, “Enigma rotor specifications” (opens in a new tab). The fifth is B. Naskręcki’s course chapter on the Enigma (opens in a new tab).

      The machine was also checked against two example messages from the Rijmenants simulator manual, credited there to Frode Weierud and Geoff Sullivan.

      History: Crypto Museum, “Enigma history” (opens in a new tab) and “Bombe” (opens in a new tab). Bletchley Park, “Enigma” (opens in a new tab).

      The IEEE Milestone, the page on the Polish Cipher Bureau’s work on Enigma, 1932–1939 (opens in a new tab). GCHQ, “The Pyry Forest meeting” (opens in a new tab). The National Museum of Computing, “Bombe” (opens in a new tab).

      On the letter that never becomes itself: Codes and Ciphers Heritage Trust, “Enigma vulnerabilities” (opens in a new tab), and Crypto Museum, “How Enigma works” (opens in a new tab). Checked 19 November 2026.