Home › Ciphers › Enigma Machine

Enigma Machine

The Enigma was the cipher machine of the Second World War: three spinning rotors, a reflector and a plugboard that together offered on the order of 159 quintillion possible settings — and it fell anyway, to Polish and British mathematicians working on the machine's habits as much as its mathematics. This simulator reproduces the Wehrmacht Enigma I (the machine also used, in naval dress, as the M3) faithfully: choose rotors I–V, set the rings and the start letters, wire up to ten plugboard pairs, pick reflector B or C, and type. The machine is reciprocal — type the ciphertext back at identical settings and the plaintext returns.

In short

The Enigma is an electromechanical rotor cipher machine: each keypress steps at least one rotor, then sends a signal through a plugboard, three rotors, a reflector, and back through the rotors and plugboard, lighting a different letter. Because the rotors move, the substitution changes with every letter — and because the path is symmetric, the same settings encrypt and decrypt. No letter can ever encrypt to itself.

Enigma I (army and air force) and M3 (navy) share the rotors simulated here. Not a code: a machine polyalphabetic cipher whose key is its daily setup.

The machine — set it, then type

10 letters

Rotor windows — where the rotors stand after your text

AleftAmiddleAright
Enciphered · Enigma I · rotors I II III · rings AAA · start AAA · reflector B · no plugs
ILBDA AMTAZ

Everything runs in your browser — nothing is uploaded. To decrypt, keep every setting identical and type the ciphertext: the machine is its own inverse.

How it works

A different substitution for every letter

Each keypress does two things. First, the rotors step: the right rotor always advances one place, the middle rotor advances when the right rotor sits at its turnover notch — and, in the machine's famous double-step, the middle rotor also steps when it sits at its own notch, carrying the left rotor with it. The windows above show where the rotors end up after your text; because of the double-step, the middle rotor can move on two consecutive keypresses, and the full cycle of positions is 26 × 25 × 26 = 16,900 rather than a clean 17,576.

Then the signal travels: keyboard → plugboard (which swaps up to ten pairs of letters) → right, middle and left rotors → reflector (which sends it back on a different contact) → left, middle and right rotors in reverse → plugboard again → lamp. Two design facts shape everything about Enigma. The reflector makes the path symmetric, so identical settings encrypt and decrypt. And the reflector never returns a signal to the contact it came from, so no letter can ever encrypt to itself — a small quirk that gave Bletchley Park's cribs their grip, because a guessed phrase could be slid along a ciphertext and every position where a letter aligned with itself crossed off instantly.

The ring setting (Ringstellung) rotates a rotor's internal wiring against its alphabet ring: it changes both the substitution and the point at which that rotor makes its neighbour step. The start position (Grundstellung) is where the windows begin — in real procedure, chosen fresh for each message and signalled to the receiver.

Origin & history

From a 1918 patent to Bletchley Park

The German engineer Arthur Scherbius patented the rotor cipher machine in 1918 and marketed Enigma commercially through the 1920s; the German military adopted progressively hardened versions from the late 1920s, adding the plugboard — the single biggest contributor to the key space. The break began not in Britain but in Poland: in 1932 the mathematician Marian Rejewski, working for the Polish Cipher Bureau with material from French intelligence, reconstructed the rotor wirings mathematically, exploiting the German habit of enciphering each message key twice. Poland shared its methods, replica machines and Bombe forerunners with Britain and France in the summer of 1939, weeks before the invasion.

At Bletchley Park the attack was industrialised: Alan Turing and Gordon Welchman's Bombe machines tested daily keys against cribs — guessed plaintext such as the weather services' WETTERBERICHT — while procedural slips did the rest. Operators chose lazy message keys (keyboard patterns, initials, one letter three times — the "cillies" that Dilly Knox's assistant Mavis Batey and the Herivel tip taught the breakers to try first), keys were repeated in depth, and the doubly-enciphered message key survived until May 1940. The machine's mathematics held for years; the routine around it did not.

Reference

The rotor wirings, as fitted

Each wiring string reads the rotor's output contacts for inputs A–Z with the ring at A and the rotor at position A; the notch letter is the window letter at which that rotor makes its left-hand neighbour step. The table is drawn from the same constants the simulator runs on, so the reference and the machine cannot disagree.

Worked examples

Five A's, five different letters

Example 1 — the standard test vector

AAAAA → BDZGO (rotors I II III, rings AAA, start AAA, reflector B, no plugs)

Five identical letters in, five different letters out: before the first A is enciphered the right rotor steps A→B, and it steps again before every following letter, so each A meets a different wiring. This exact vector is the simulator's unit test — type AAAAA at the default settings and BDZGO is what a correctly built Enigma must produce.

Example 2 — the default message, and reading it back

HELLO WORLD → ILBDA AMTAZ

The tool's opening state. Now press "Send result to input" without touching a single setting and type nothing new: ILBDA AMTAZ enciphers straight back to HELLO WORLD, because the reflector makes every path reversible. Change anything — one ring letter, one plug — and the read-back dissolves into gibberish, which is why operators transmitted their message key as part of the procedure, and why a mistake in it cost the whole message.

Breaking it

159 quintillion settings, broken by routine

The key space is genuinely enormous: 60 ways to order three rotors from five, 17,576 start positions, and 150,738,274,937,250 ways to wire ten plugboard pairs — the commonly cited product is about 1.59 × 1020 settings (ring settings multiply it further still). Brute force was never the way in. The way in was structure: the no-self-encryption rule let a crib be tested at every position at machine speed; the Bombe's logic chains eliminated plugboard possibilities wholesale; and human routine — repeated keys, lazy keys, formulaic weather reports — supplied the cribs and the shortcuts.

  • Security status: formidable for its era; broken in practice from 1932 (in principle) and read at scale from 1940.
  • What gives it away: a letter never standing for itself, plus any guessed plaintext to slide along the text.
  • The real weakness: procedure. Every historic break came through key discipline failures, not through the rotor mathematics.
Variants

The Enigma family, and its rivals

MachineHow it differsSolve it with
Naval M4A fourth, thin rotor (Beta or Gamma) that did not step, thin reflectors, and three extra rotors (VI–VIII) — the U-boat machine whose 1942 blackout cost Bletchley ten monthsThis simulator covers its three-rotor core; the M4's fourth rotor is a fixed extra reflection stage
Abwehr EnigmaThe intelligence-service model: no plugboard, a reflector that itself stepped, and rotors with multiple notchesDifferent stepping rules — not interchangeable with this machine
Lorenz (SZ40/42)Not an Enigma at all: a twelve-wheel teleprinter cipher for Hitler's high command, broken at Bletchley by the work that led to ColossusThe Lorenz page
Typex & SIGABAThe Allied answers — Britain's Typex adapted the Enigma idea with more rotors; America's SIGABA stepped its rotors irregularly and was never brokenThe Typex and SIGABA pages
Uses & culture

Why Enigma still matters

Enigma is the hinge between classical and modern cryptology: a machine cipher strong enough to demand mathematics, statistics, engineering and espionage all at once, whose defeat built the first programmable electronic computer (Colossus, for Lorenz) and staffed the institutions that became GCHQ and the NSA. Working simulators like this one are museum pieces you can touch — Bletchley Park and the NSA's National Cryptologic Museum run the real thing — and setting a daily key by hand teaches the era's central lesson faster than any summary: the operators' discipline was part of the cipher, and it was the part that failed. In fiction and film the machine is shorthand for the whole secret war, from U-571's fictionalised capture to The Imitation Game's Turing story.

Practice

Run the machine

Practice 1 — read the default message back

ILBDA AMTAZ at the default settings → ?

Keep rotors I II III, rings and start at AAA, reflector B, no plugs — and simply encipher the ciphertext.

Reveal the answer

HELLO WORLD — the machine is reciprocal, so enciphering is decrypting.

Practice 2 — one plug changes everything

HELLOWORLD with plugs HL WO → ?

Two cables: H swaps with L and W with O before and after the rotors. Predict which letters of the output can still appear — then check.

Reveal the answer

PHTKQKQTTZ — wholly different from the unplugged ILBDAAMTAZ, and still with no letter standing for itself.

FAQ

Frequently asked questions

How do I decrypt an Enigma message?

Set the machine exactly as the sender had it — same rotors in the same order, same rings, same start letters, same plugs, same reflector — and type the ciphertext. The plaintext comes out, because the signal path is symmetric. If even one element differs you get convincing-looking gibberish, which is why the message key travelled with the message.

Why can a letter never encrypt to itself?

The reflector sends every signal back into a different contact by construction, so no path can return a letter unchanged. It feels like a detail; it was a structural flaw. Codebreakers sliding a guessed phrase (a crib like WETTERBERICHT) along the ciphertext could instantly reject every position where any letter aligned with itself.

What is the double-stepping anomaly?

The middle rotor steps not only when its right neighbour reaches its notch, but also when it sits on its own notch — so it can step on two consecutive keypresses, unlike a car's odometer. This simulator reproduces it; it makes the effective rotor period 26 × 25 × 26 = 16,900 instead of 17,576, and any implementation that omits it disagrees with the real machine.

How was Enigma actually broken?

In stages, and first by mathematics, not machines. In 1932 Marian Rejewski reconstructed the rotor wirings, exploiting the doubled message key. Poland shared the work in 1939; at Bletchley Park, Turing, Welchman and thousands of others industrialised the break with Bombes, daily cribs, captured key sheets — and the reflector's gift that no letter encrypts to itself. The mathematics held for years; the procedures around it failed.

Is this the machine from the U-boats?

Nearly: the navy's M3 used these same rotors and reflectors. The later M4 added a fourth, non-stepping thin rotor and extra rotors VI–VIII for the U-boat networks — the settings space grew, and so, for ten months of 1942, did Bletchley's blackout.

Next steps