Enigma Machine Simulator
Set the rotors, type a message and read the result. To decode, use the same settings and paste the coded text.
How it works
The Enigma was an electric cipher machine used by the German armed forces before and during the Second World War. It looks like a typewriter. When the operator pressed a key, a lamp lit up under a different letter, and that lamp letter was the coded text.
The path of one letter. Pressing a key sends current through the plugboard, then through three rotors from right to left, into a reflector that turns it around, back through the three rotors and the plugboard again, and finally to a lamp. Each rotor is a wheel with 26 contacts on each face, wired together in a scrambled order.
Why it was hard to break. Before each letter is coded, the right rotor turns one step. Once per full turn it pushes the middle rotor one step, and the middle rotor does the same to the left one. So the wiring changes with every key press, and the same letter typed twice comes out as two different letters. The settings repeat only after about 17,000 letters.
The settings. Sender and receiver had to agree on four things, which changed daily from a printed key sheet:
- Rotor order: which three of the five rotors to use, and in which slots.
- Ring settings: how the wiring of each rotor is rotated against its letter ring.
- Start positions: the three letters showing in the windows at the start.
- Plugboard: pairs of letters swapped by cables, usually ten pairs.
The same settings decode. Because of the reflector, the machine is its own inverse. If A becomes G at some position, then G becomes A at that same position. To read a message, set the machine exactly as the sender did and type the coded text.
The weakness. The reflector also means a letter can never be coded as itself. That one fact let codebreakers rule out huge numbers of possibilities. Polish mathematicians first broke the machine in the 1930s, and the work was carried on at Bletchley Park in England.
This simulator follows the three rotor Enigma I, with rotors I to V and reflectors B and C, and includes the double step of the middle rotor.
Worked example
With rotors I, II and III, reflector B, all rings at A and start positions AAA, typing AAAAA gives BDZGO. Reset to AAA and type BDZGO, and you get AAAAA back.
Common questions
How do I decode an Enigma message?
Set the same rotors, ring settings, start positions and plugboard pairs that were used to encode it, then type or paste the coded text.
Why can a letter never encode to itself?
The reflector sends the current back along a different wire from the one it arrived on, so the path can never end on the key that was pressed.
Which Enigma model is this?
The three rotor Enigma I used by the German army and air force, with rotors I to V and reflectors B and C.
Do spaces and numbers work?
The real machine had only the 26 letters. Here, spaces and other characters pass through unchanged and do not move the rotors.