Enigma Machine Simulator

Interactive Enigma machine simulator with authentic WWII rotor configurations. Encrypt and decrypt messages, configure plugboard and reflector settings.

Advertisement

Enigma simulator: set the rotors, ring settings and plugboard, then encipher a message

This is a working model of the three–rotor Wehrmacht Enigma I. You choose which three rotors go in the machine and in what order, set each rotor's start position and ring setting, pick a reflector, patch up to thirteen letter pairs on the plugboard, and type. Every keystroke steps the rotors first, then sends the signal through the plugboard, the three rotors right–to–left, the reflector, back through the rotors left–to–right, and out through the plugboard again. Everything runs in your browser — the machine is a few hundred lines of arithmetic, nothing is uploaded, and there is no server round trip to wait for.

The tool is deliberately narrow. It models Enigma I with rotors I–V and reflectors UKW–A, UKW–B and UKW–C. It does not model the four–rotor naval M4, rotors VI–VIII, the thin Beta/Gamma rotors, Umkehrwalze D, or the Enigma Uhr. It also does not attempt to break anything: there is no bombe, no crib dragging, no key search. If you came to encipher and decipher with known settings and watch exactly what the machine does, this is the right page. If you came to crack an unknown key, it is not.

What the four tabs do

  • Cipher — the message box and output box, a live readout of the three rotor windows, and three preset buttons that load a complete configuration in one click. Tick Show encryption steps to get a card per character showing the rotor windows at the moment that letter was typed, the input letter and the output letter. Click a card to expand the full signal path for that one keystroke. The card strip is capped at the first 20 characters; anything beyond that is summarised as a count.
  • Configuration — three rotor slots labelled Left (Slow), Middle and Right (Fast). Each slot has a rotor selector (I to V), a start position selector (A–Z), a ring setting selector (01–26), and a read–only line showing that rotor's turnover notch letter. Below that, the three reflectors and the plugboard.
  • Signal Path — a static block diagram of the route a current takes: keyboard, plugboard, right rotor, middle rotor, left rotor, reflector, and back.
  • History — short notes on the machine, on how it was broken, and on the double–step quirk, with the presets repeated as cards.

The five settings that make up a key

An Enigma key in this simulator is four things, and the message only comes out right if all four match on both ends.

SettingGerman termWhat it is hereChoices
Rotor selection and orderWalzenlageThree of the five rotors, in a specific left–middle–right order60
Start positionsGrundstellungThe letter showing in each of the three windows before you type17,576
Ring settingsRingstellungOffset between each rotor's wiring and its letter ring, 01–2617,576
ReflectorUmkehrwalzeUKW–A, UKW–B or UKW–C3
Plugboard pairsSteckerbrettLetter swaps applied before and after the rotorsup to 13 pairs

Where do the counts come from? Rotor order is 5 × 4 × 3 = 60 ordered choices from a set of five. Positions and ring settings are each 263 = 17,576. The plugboard with the ten leads the Wehrmacht typically issued is 26! ÷ (6! × 10! × 210) = 150,738,274,937,250 — you choose which 20 of the 26 letters get plugged, pair them up, and divide out the orderings that describe the same wiring. Multiply rotor order by positions by the ten–lead plugboard and you get 60 × 17,576 × 150,738,274,937,250 = 158,962,555,217,826,360,000, the familiar figure of roughly 1.59 × 1020.

Ring settings are normally left out of that headline number, and it is worth knowing why. Advancing a ring setting by one and advancing the matching start position by one produces the same substitution — the two changes cancel. What a ring setting genuinely changes is where in the message the turnovers fall, because the notch travels with the letter ring. So it is not an independent multiplier on the alphabet mapping; it is a control over the stepping schedule. That is also why getting the ring settings wrong gives you plausible–looking output that suddenly diverges partway through a message rather than being garbage from the first letter.

Stepping, and the double–step anomaly

The right rotor advances one place on every keypress, before the letter is enciphered. When a rotor reaches its notch letter, it carries the rotor to its left on the following keypress — an odometer. The notch letters in this simulator are the historical ones, and the Configuration tab prints the notch for whichever rotor you have selected:

RotorTurnover notchMnemonic
IQRoyal
IIEFlags
IIIVWave
IVJKings
VZAbove

The mnemonic is the traditional one: "Royal Flags Wave Kings Above" — rotor I steps the next rotor when it moves from Q to R, rotor II from E to F, rotor III from V to W, rotor IV from J to K, rotor V from Z to A.

The famous quirk is the middle rotor's double step. A real Enigma's stepping is driven by pawls, and the pawl that pushes the middle rotor also engages the middle rotor's own notch — so once the middle rotor is sitting on its notch, it drags itself forward on the next keypress at the same time as it carries the left rotor. The result is that the middle rotor moves on two consecutive keypresses and one letter of its cycle is skipped.

You can watch it happen. Load rotors I, II, III (left to right), all ring settings 01, and set the windows to A D U. Type five letters with Show encryption steps on, and the window readings recorded per keystroke are:

KeypressWindows after steppingWhat moved
1A D Vright rotor only
2A E Wright was on its notch V, so the middle rotor stepped D → E
3B F Xmiddle is now on its own notch E, so it steps again (E → F) and carries the left rotor A → B
4B F Yright rotor only
5B F Zright rotor only

The middle rotor went D, E, F on consecutive keypresses instead of dwelling on E for 26 letters. Any simulator that gets this wrong will match a genuine machine for a while and then silently drift — which is exactly the failure mode people hit when a decipherment starts clean and turns to noise around 26 characters in.

Why a letter can never encipher as itself

The reflector is wired as a set of thirteen fixed pairs, and each of UKW–A, UKW–B and UKW–C in this tool is a genuine involution with no letter wired to itself. The current enters the rotor stack, hits the reflector, comes back through the same three rotors in the opposite direction, and lights a lamp. Because the reflector never returns a letter to the contact it arrived on, and every other stage is a reversible one–to–one mapping, the lit lamp can never be the key you pressed.

This is not a subtlety; it is the flaw. It gives the whole machine its convenient property — encipherment and decipherment are the same operation, so an operator with the right settings just types the ciphertext and reads the plaintext — and it hands a cryptanalyst a free test. If you suspect a stretch of ciphertext contains a particular German phrase, you can slide that guess along the ciphertext and instantly discard every alignment where any letter of the guess sits above the same letter in the ciphertext. Those alignments are impossible, no key search required. Cribs like predictable weather reports and stereotyped message openings, combined with this one constraint, are what made a mechanised search practical. The Polish Cipher Bureau broke Enigma traffic in the 1930s and passed the work to Britain and France; at Bletchley Park, Alan Turing and Gordon Welchman built the bombe around exactly this style of contradiction test.

You can confirm the property on this page in about ten seconds: clear the plugboard, type the alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ, and check the output against the input character by character. No position will match, at any rotor setting, with any reflector, with or without plugboard leads.

Worked example you can reproduce exactly

Set rotors I (left), II (middle), III (right), all ring settings 01, all windows on A, reflector UKW–B, plugboard empty. This is the canonical smoke test for an Enigma implementation.

  • Type AAAAAAAAAA and the output is BDZGOWCXLT.
  • Type HELLOWORLD and the output is ILBDAAMTAZ.
  • Reset the windows back to A A A, type ILBDAAMTAZ, and you get HELLOWORLD back. That round trip is the whole point of the reflector.

Two follow-ups that show how sensitive the key is. First, change only the right rotor's ring setting from 01 to 02, leave everything else alone, and AAAAA now produces UBDZG instead of BDZGO. One ring notch, on one rotor, and every letter changes. Second, change only the reflector: with everything else at the same default settings, AAAAA gives BDZGO on UKW–B, SSKWS on UKW–A and PJBUZ on UKW–C. If your decipherment is complete nonsense from the very first character, a wrong reflector or a wrong rotor order is far more likely than a wrong ring setting.

Reproducing a message from a key sheet

If you have a set of settings and a ciphertext, the order to enter them matters less than getting all of them in before you type. Work through it like this:

  • Open Configuration and set the rotor order first, left slot to right slot. Getting this wrong is the most common mistake, because key sheets list the Walzenlage left–to–right the same way the machine is loaded, but plenty of transcriptions reverse it.
  • Set the ring settings. If your source gives them as letters rather than numbers, A is 01 and Z is 26.
  • Pick the reflector. Wehrmacht Enigma I traffic overwhelmingly used UKW–B.
  • Enter the plugboard pairs, two letters at a time, in the box marked Enter pair (e.g., AB), then press Add. Order within a pair does not matter and the swap is symmetric. The tool refuses a pair if either letter is already patched, refuses a letter paired with itself, and stops at thirteen pairs because 26 letters cannot support more. Click a pair chip to remove it.
  • Go back to Cipher and set the three window letters to the message's start position. In the historical procedure this is the message key, transmitted in the indicator group at the head of the message and itself enciphered at a separate ground setting — that indicator procedure is not modelled here, so you must supply the already–decoded start position yourself.
  • Paste the ciphertext. Output appears as you type.

The input is normalised before anything else happens: it is upper–cased and every character that is not A–Z is discarded. Spaces, digits and punctuation simply vanish rather than passing through, which matches operating practice — German procedure spelled numbers out and used letter groups such as X for full stops — but it does mean the output is one unbroken run of letters with no word breaks to help you. Read it in five–letter groups the way the original messages were transmitted.

When the output is wrong

  • Garbage from character one. Rotor order, reflector, or a plugboard pair is wrong. Ring settings would not do this on their own.
  • Correct for a while, then garbage. A ring setting is off, so a turnover is happening in the wrong place. Check the middle rotor's ring first.
  • Correct except for a handful of letters scattered through. A single plugboard pair is missing or mistyped. A plugged pair only affects letters that touch it, so the damage is sparse rather than total.
  • Everything is right but the message drifts near the 26th letter. That is the double–step boundary. This simulator handles it, so if you are comparing against another implementation, suspect the other one.
  • You typed the plaintext but expected the ciphertext, or vice versa. There is no mode switch and there does not need to be one — but you must reset the window letters to the start position before each run, because typing advances them.

About the presets

Three buttons load a complete configuration: a simple all–A test case, and two labelled with historical flavour. Treat them as convenient starting configurations for experimenting, not as authenticated key–sheet entries — and note that the naval one is a three–rotor setup on this three–rotor machine, not the four–rotor M4 the Kriegsmarine used on Atlantic traffic. Loading a preset overwrites your current rotors, rings, reflector, plugboard and message.

A note on security

Enigma is comprehensively broken and has been for eighty years. A modern laptop recovers a full key from a moderate amount of ciphertext, and the double–step schedule, the no–letter–maps–to–itself property and the reciprocal plugboard all narrow the search enormously. Use this to learn the machine, to check a puzzle answer, or to reproduce a historical message. Do not use it to protect anything. If you want to see how a genuinely unbreakable classical scheme differs, the one-time-pad tool on this site is the honest comparison — not because it is more elaborate, but because it is the only one with a proof.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.