How to use it
This is a working model of the three-rotor machines used by the German armed forces in World War II. Press a key and two things happen: first the rotors turn, then a current runs from the key through the plugboard, the three rotors and the reflector, back through the rotors and the plugboard to one lamp. The lit letter is the ciphertext.
Everything you type goes onto the tape; you can also paste a text. The machine has only 26 keys, so digits, spaces and punctuation are skipped and letters with diacritics become plain letters (é → E). To decrypt, start from the same settings and type the ciphertext: the plaintext lights up. “Decrypt: run the output again” does this in one press.
Controls
- Keys: tap or click them, or type A–Z on your keyboard. Arrow keys move between the on-screen keys, Backspace takes back the last letter, “Reset to start” clears the tape.
- ▲ and ▼ change a rotor’s start position. The windows show the positions now, and the tape is run again from the new start.
- Settings: three of five rotors in any order, ring settings, start positions, reflector B or C and up to 13 plugboard pairs.
- Signal path: Next and ◀ walk the last letter through the machine stage by stage.
How it works
A rotor is a disc with 26 contacts on each side, cross-wired inside. Number the letters A = 0 to Z = 25. If a rotor’s wiring is W, its window shows p and its ring setting is r, then with k = p − r a letter x leaves the rotor as
With the plugboard P, the right, middle and left rotors R, M, L and the reflector U, one key press applies, from left to right:
The plugboard and the reflector only swap letters in pairs, so E is its own inverse: if A lights S, then S lights A, and the same settings decrypt. The reflector never connects a contact to itself, so no letter is ever encrypted to itself, a flaw that helped the codebreakers.
Stepping. The right rotor steps before every letter. When it steps on from its turnover letter (Q on rotor I, E on II, V on III, J on IV, Z on V), the middle rotor steps too. When the middle rotor stands on its own turnover letter, the next press steps it again together with the left rotor: the double step. So A D U goes to A D V, A E W and B F X. The middle rotor turns once every 25 × 26 = 650 presses, and the windows repeat after 26 · 25 · 26 = 16 900 presses.
Ring settings. Only the difference p − r changes the wiring; the ring really moves the moment of the turnover. The left rotor passes no turnover on, so its ring adds nothing beyond its start position.
Settings. There are 5 · 4 · 3 = 60 rotor orders and 26³ = 17 576 start positions. Ten plugboard pairs can be chosen in 26! / (6! · 10! · 210) = 150 738 274 937 250 ways. Together that is 158 962 555 217 826 360 000, about 267; the middle and right rings multiply it by 676.
Things to try
- Press A five times with the default settings, then press “Decrypt”: BDZGO turns back into AAAAA.
- Load the double-step example and press three keys: the windows show A D V, A E W, B F X. Then run the cycle counter and watch the windows come back after 16 900 presses.
- Type the same letter 26 times. That letter never lights.
- Move the left ring and the left start up by one letter each: the output stays the same. On the right rotor the output changes from the first turnover on.
- Slide the crib WEATHERREPORT along the example message and count the places the clashes rule out.
Frequently asked questions
Are these the real wirings?
Rotors I to V and reflectors B and C follow the wirings published in the historical record, but the Sources below cover the codebreaking history, not the wiring tables themselves. Rotors IV and V were added in December 1938, so operators then chose three of five.
How was the machine broken?
In December 1932 Marian Rejewski of the Polish Cipher Bureau worked out the rotor wiring with permutation theory, helped by documents obtained by French intelligence. With Jerzy Różycki and Henryk Zygalski he found ways to recover the daily settings, and in July 1939 the Poles shared their results with French and British codebreakers. At Bletchley Park, Alan Turing designed the bombe, which searched for settings that fit a crib, and Gordon Welchman’s diagonal board sharply reduced its false stops.
Why does it matter that no letter becomes itself?
It shows where a guessed word cannot be. A crib had to be placed correctly before a bombe run, and every clash ruled a placement out.
Is it secure today?
No. A computer searches the rotor settings quickly and statistics recover the plugboard. Use it to learn, not to protect anything.
Sources
- O’Connor JJ, Robertson EF (2007). Marian Rejewski. MacTutor History of Mathematics, University of St Andrews. Rejewski’s use of permutation theory in 1932–33, his work with Różycki and Zygalski and the meeting with French and British codebreakers at Pyry in July 1939.
- Wikipedia contributors (accessed 25 October 2026). Marian Rejewski. Wikipedia. The documents from French intelligence that reached Rejewski about 9 or 10 December 1932 and helped him solve the wiring of the rotors and the reflector, and the two extra rotors of December 1938.
- The National Museum of Computing. The Turing-Welchman Bombe. Museum page on its working reconstruction. Turing’s bombe for attacks with cribs and Welchman’s diagonal board, which sharply reduced the false stops.