Chris Spackman – Cryptography

The Zimmermann Telegram

On January 16, 1917, German Foreign Minister Arthur Zimmermann sent a coded telegram to the German ambassador in Mexico. Its contents were explosive: a proposal for a military alliance between Germany and Mexico against the United States. British codebreakers intercepted and decoded it, and when the message was made public, it helped push America into World War I.

This is a story about how codebreaking changed history — and how the codebreakers then had to solve an even harder problem: revealing what they knew without revealing how they knew it.

Background

Room 40

When World War I began in 1914, one of Britain's first acts was to cut Germany's undersea telegraph cables. This forced German diplomatic messages onto routes that passed through British-controlled relay stations — where they could be copied.

The Admiralty established a secret codebreaking unit known as Room 40 (named after its office number). Led by Sir Alfred Ewing and later by Captain Reginald "Blinker" Hall, Room 40 employed linguists, classicists, and puzzle enthusiasts to decode intercepted German messages.

How Did Room 40 Get Germany's Codebooks?

Early in the war, Room 40 had extraordinary luck. In August 1914, the Russians recovered a German naval codebook from the wreck of the cruiser Magdeburg and shared it with Britain. Another codebook was pulled from a German ship seized by Australia. These captured codebooks gave Room 40 a critical head start, but the diplomatic codes used for the Zimmermann Telegram still required significant analytical work to break.

Germany's Dilemma

By early 1917, Germany was losing the war of attrition on the Western Front. German military leaders decided to resume unrestricted submarine warfare — sinking any ship, including neutral American ships, in the waters around Britain. They knew this would probably bring the United States into the war, but they gambled they could starve Britain into surrender before American forces could arrive.

As an insurance policy, Zimmermann proposed an alliance with Mexico: if the US entered the war, Germany would help Mexico reclaim territory lost in the Mexican-American War — Texas, New Mexico, and Arizona. Mexico was also asked to invite Japan to join the alliance.

The Coded Message

Berlin sent the telegram to its Washington embassy in a German diplomatic codebook called Code 0075: a new two-part code, issued in 1916, in which words and phrases were replaced by number groups of four or five digits. The German legation in Mexico City did not have 0075, so the Washington embassy decoded the message and re-encoded it in an older book, Code 13040, before forwarding it by Western Union on January 19. In these code systems, whole words and phrases become numbers. This is fundamentally different from the letter-substitution ciphers of earlier centuries — there is no rule connecting a word to its number, only the book.

Here is the whole coded telegram exactly as it went from Washington to Mexico City: the Western Union copy, in Code 13040, which used groups of three, four and five digits. Click any number to decode it, or step through from the start. Decoded groups show the German word the book stood for; switch to English glosses if you prefer. Hover a decoded word to see its number again.

Decoded groups in

Look Up a Group

The meanings on this page come from a real document. On March 2, 1917, Edward Bell of the US Embassy in London sat down with a Room 40 cryptanalyst and decoded the Western Union copy himself, group by group, so that Washington would have proof the telegram was genuine. His worksheet went to the State Department with Ambassador Page's letter and is now in the US National Archives. Type any group to look it up (leading zeros do not matter):

Every Group in the Telegram

This is everything one telegram reveals about Code 13040: 134 different groups out of a book of many thousands. Click a row to decode that group in the telegram. The last column counts how often each group appears — and notice how many different groups mean the same thing.

The Decryption

Room 40 cryptanalysts Nigel de Grey and William Montgomery partially decoded the telegram on January 17, 1917 — just one day after it was sent. They quickly recognized its significance but faced several problems:

  1. Incomplete decode: Code 0075 was new and Room 40 had reconstructed only part of it, so on January 17 they could read enough to see what the message was about — submarine warfare, an alliance with Mexico, Japan — but not every group. It took weeks of work on the gaps, and the complete text came from the Mexico City copy in the older Code 13040, which Room 40 could read almost in full.
  2. The source problem: If Britain simply handed the decoded telegram to the Americans, Germany would know its codes were broken and would change them. Britain needed to disguise how it obtained the message.
  3. The neutrality problem: The telegram had been partly routed through a cable that the US had allowed Germany to use for peace negotiations. Revealing this would embarrass the Americans.

The Cover Story

Captain Hall solved the source problem with a clever deception. British agents in Mexico obtained a copy of the telegram as it had been re-transmitted from Washington to Mexico City. A British agent in Mexico City bought a copy from the telegraph office on February 10. This version was in the older Code 13040, which Room 40 could read almost in full, so it also filled the gaps in the January reading. By presenting this copy to the Americans, Hall could claim the message had been obtained in Mexico rather than intercepted on the transatlantic cable. This protected both Britain's codebreaking capability and American diplomatic sensibilities.

How a Codebook Gets Broken

Room 40 never captured a copy of Code 13040. It reconstructed the book over two years from hundreds of intercepted messages, and this one telegram shows every kind of clue the analysts worked with. Use the decoded telegram and the table above to check each one yourself.

1. Repeats

The same group for the same word, every time, is the fundamental weakness of a plain codebook. In this telegram 67893 (Mexiko) appears three times, 5905 (Krieg) three times, 22464 (Präsidenten), 52262 (Japan) and 98092 (U-Boot) twice each. An analyst who has seen 67893 in earlier traffic to and from Mexico City already knows what it means, and a group that suddenly appears three times in a telegram to Mexico is a very good candidate for "Mexico" even if it is new.

2. Many groups for one word

The book fought back against frequency analysis with homophones: the worksheet reads eleven different groups as a full stop (18222, 10371, 18101, 4725, 13851, 14471, 23552, 21272, 7762, 10482, 3569), five as a comma, six as zu (11264, 11265, 11267, 11269, 11310, 11311) and three as und (6926, 6929, 6992). The most common words get the most alternatives. Notice, though, how close together the alternatives sit — which brings us to the next clue.

3. Traces of alphabetical order

In a well-made two-part code the numbers are assigned at random, so knowing that 13401 means Auswärtiges Amt tells you nothing about 13339. Code 13040 was not like that. Friedman and Mendelsohn, who studied it for the US Army in 1938, noted that it "retained decided traces of its original alphabetical arrangement," and the telegram shows them:

GroupGerman
13339ausall aus- words, in order
13347Ausbruch
13401Auswärtiges Amt
13486Aussicht
17138früherfr- then fü-, in order
17142Frieden
17149Friedensschluss
17166führen
11264 – 11311zu (six times)the zu block
11347zum

This is a gift to the analyst. If 17142 is Frieden and 17166 is führen, then an unknown 17149 must be a word between them in the dictionary, and a context that needs a noun after gemeinsam ("together ... peace-making") settles it. Every recovered group narrows the possibilities for its neighbours. Code 0075, the new two-part book without this ordering, was the one Room 40 could read only in part.

4. Words the book did not have

Arizona was not in Code 13040, so the clerk spelled it in syllables: 5454 16102 15217 22801 = AR IZ ON A. A run of rare groups right after "Texas" and "New Mexico" is easy to spot, and once the syllables are known they can be read wherever they turn up. (The CODEX Decryptor on this site attacks spelled-out names in exactly this way.)

5. Stereotyped openings and endings

Diplomatic telegrams began and ended the same way every time: Auswärtiges Amt telegraphiert, a date, a serial number, ganz geheim, selbst zu entziffern … and at the end Empfang bestätigen, a signature, Schluss der Depesche. An analyst can guess these words before reading a single group. A guessed word used as a lever is called a crib, and it was the everyday tool of Room 40, Yardley's Black Chamber and, later, Bletchley Park.

6. Two codes, one message

The same text went out in 0075 and again in 13040. Once Room 40 had the 13040 copy and could read it, it also had the complete German plaintext of a message it held in 0075 — a known-plaintext windfall that filled in dozens of 0075 groups at once. Sending the same message in a strong code and a weak one is one of the oldest mistakes in cryptography, and it is still made.

The Impact

The decoded telegram was given to the US Ambassador in London on February 23, 1917. President Wilson made it public on March 1. Many Americans initially believed it was a forgery — until Zimmermann himself confirmed its authenticity on March 3, astonishing everyone.

Combined with Germany's resumption of unrestricted submarine warfare, the Zimmermann Telegram helped turn American public opinion decisively in favor of entering the war. The United States declared war on Germany on April 6, 1917.

"I cannot deny it. It is true." — Arthur Zimmermann, confirming the telegram's authenticity, March 3, 1917

Lessons for Cryptography

Code vs. Cipher

The Zimmermann Telegram illustrates the difference between a code and a cipher. A cipher transforms individual letters according to a rule (like the Caesar cipher or Vigenère cipher). A code replaces entire words or phrases with arbitrary symbols (in this case, numbers). Codes require a codebook — essentially a dictionary — that both sender and receiver must possess.

Codes have a major advantage: since there is no mathematical relationship between the code numbers, techniques like frequency analysis do not apply directly. But they also have weaknesses: codebooks can be captured, they are inflexible (you can only say things that are in the book), and patterns in their use can be exploited over time.

The Intelligence Dilemma

Room 40's greatest challenge was not breaking the code — it was deciding what to do with the information. Using decoded intelligence always risks revealing that you have broken the enemy's codes. This tension between using intelligence and protecting its source is a fundamental problem that would recur throughout the 20th century, particularly at Bletchley Park during World War II.

Things to Try

Disclaimer: these pages are educational demos provided as-is, with no warranty of any kind. The author is not responsible for any consequences arising from their use.

Send comments and bug reports to chris@chrisspackman.com.

Version 0.2.0 — Last updated: 2026-10-25

This page is Copyright © 2025 – 2026 Chris Spackman <chris@chrisspackman.com>.
This web site developed entirely on GNU/Linux with Free / Open Source Software.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Creative Commons License