TRUE CRIME · 1586
The Cipher That Killed Mary, Queen of Scots
Mary, Queen of Scots trusted a secret cipher with her life. The codebreaker who cracked it turned her own words into the evidence that sent her to the block in 1587.
THE SHORT VERSION
Mary, Queen of Scots used a nomenclator cipher, a substitution alphabet plus symbols for whole words and names, to plot against Elizabeth I. Her spymaster's codebreaker, Thomas Phelippes, broke it with frequency analysis and turned her own coded letters into the evidence that condemned her in 1587.
Why was Mary, Queen of Scots writing in secret?
By 1586, Mary Stuart had been Elizabeth I’s prisoner for nineteen years: a rival queen too dangerous to free and too royal to kill. Catholic Europe considered her the rightful heir to the English throne, which made every letter she wrote a potential act of treason. She knew it. Twice already, plots had formed around her name. The Ridolfi conspiracy of 1571 and the Throckmorton plot of 1583 had both aimed to depose Elizabeth and crown Mary, and both had been unpicked by Elizabeth’s intelligence service. By the time a young Catholic gentleman named Anthony Babington came to her with a third scheme, Mary was watched around the clock at Chartley in Staffordshire, her rooms searched, her household cut to a handful of servants. If she was going to answer him at all, there was only one way that felt safe. In writing, and in code.
What cipher did Mary, Queen of Scots use?
The cipher Mary trusted was no parlor trick. It was a nomenclator, a hybrid of two ideas: a cipher alphabet for spelling words out letter by letter, and a small codebook of symbols standing in for whole words and names. Her key ran to twenty-three symbols for the letters of the alphabet, with J, V and W folded onto their neighbours, plus roughly thirty-five more symbols for common words and for the conspirators themselves. Four of the marks meant nothing at all, nulls dropped in to waste a codebreaker’s time, and one symbol did nothing but tell the reader to double the letter that followed. Strip the codebook away, though, and the spelling-out underneath was just a simple substitution cipher, the oldest idea in code-making, and that is precisely where its weakness lay. On paper, for its day, it still looked airtight.
The letters travelled by a route Mary believed no one could see. Folded small and sealed, they rode in and out of Chartley wedged into the hollow bung of a beer barrel the local brewer delivered to the house. She trusted the channel completely. She was wrong about nearly everything in it except the beer.
How did Walsingham read Mary’s letters?
The courier who arranged the channel, a Catholic named Gilbert Gifford, was working for Sir Francis Walsingham, Elizabeth’s principal secretary and spymaster. Gifford had been in Walsingham’s pay for months, and the beer-barrel route was not a leak Walsingham had stumbled onto. It was a trap he had built. Every letter Mary sent or received went first to London, was opened, copied, resealed with a matching stamp, and only then sent on, usually inside a day. Mary was writing to her rescuers through her own gaoler’s hands, and neither she nor her correspondents noticed a thing.
It is one of the earliest recorded man-in-the-middle attacks, and still one of the cleanest. The mathematics of Mary’s cipher never mattered, because the whole road her letters travelled belonged to her enemy. The surviving pages of her ciphers, seized from her rooms after the plot collapsed, are still held at the National Archives; more than a hundred were found among her papers.
Who broke the cipher?
Walsingham handed the intercepts to Thomas Phelippes. Small, near-sighted, his face pitted by smallpox, Phelippes was fluent in several languages and, by every account of him, a natural at pulling ciphers apart. He broke Mary’s letters the way solvers still break substitution ciphers today. He counted.
A cipher that swaps one symbol for each letter hides the words but not their shape. In English the letter E turns up more often than any other, then T, then A, and the short words, the double letters and the gaps between words all leave fingerprints that survive the disguise. Phelippes matched the commonest symbol to E, the next to T, guessed at the small words, tested them, and watched the rest of the message open. The method was not even new: it had been written down in ninth-century Baghdad by the scholar al-Kindi, seven hundred years before Mary ever sealed a letter. Often Phelippes had a message read within hours of its reaching his desk.
Then he waited. On 6 July 1586, Babington wrote to Mary and set the whole plan out in plain terms, the rescue and the killing of Elizabeth together. On 17 July, Mary wrote back. In her own trusted cipher, she approved it, asking after the timing and after the six gentlemen who were to do the deed. That coded yes, in her hand, was the one piece of evidence Walsingham had been missing.
She had trusted the code with the most dangerous words she would ever write, and it carried them faithfully, straight to her executioner.
The forged postscript that sealed the plot
Phelippes wanted more than Mary. He wanted every name. So he did the one thing a forger holding the key can always do: he added a few lines to the foot of Mary’s letter, written in her own cipher, asking Babington to send the names and details of his accomplices. On his deciphered working copy he sketched a small gallows in the margin, a private joke about where all of this was heading. The forgery went out looking exactly like Mary’s own hand, and because Babington trusted the cipher as completely as she did, it never crossed his mind that the request was not hers.
The trap closed in the autumn. The conspirators were rounded up, and in September 1586 Babington and his fellow plotters were hanged, drawn and quartered. What was left to deal with was Mary.
Why a broken cipher still matters
Mary was tried at Fotheringhay Castle in October 1586, before a commission led by Walsingham and William Cecil, Lord Burghley. She was given no lawyer, no witnesses of her own, and no sight of the evidence in advance. She denied everything, and denied ever knowing Babington. But her deciphered letters were read aloud in plain English, and her own secretaries, Claude Nau and Gilbert Curle, confirmed under pressure that the words were hers. The secret alphabet she had leaned on to stay alive had become the proof used to end her. On 8 February 1587, in front of some three hundred witnesses, she was beheaded.
Her cipher had not failed the way ciphers are meant to fail. The symbols held. The substitution was sound. What failed was every person and every mile of road she trusted to carry it: the courier who answered to her enemy, the brewer, the spymaster reading each line, the quiet man in London who knew the commonest letter in the language. The strength of the cipher was never the point, and the false confidence it gave her is exactly what made her careless enough to write the words down at all. It is why the generation of codebreakers that followed abandoned simple substitution for good and turned to polyalphabetic systems like the Vigenere cipher, where the same letter is disguised a different way each time it appears.
That lesson has not moved in four hundred years. A cipher is only ever as safe as the people standing at both ends of it and the channel running between them. Flawless encryption is worth nothing if the road belongs to your adversary, which is the same reason a locked message means little the moment someone owns the screen it is read on. Mary learned it in a cold hall at Fotheringhay, from a man with a pen and a gift for counting letters. And her secrets kept slipping long after her death: in 2023, a trio of codebreakers cracked fifty-seven more of her enciphered letters, lost for centuries and mislabelled in the French national library, a last proof that the woman who trusted her life to a cipher had never been as hidden as she believed.
Questions, answered
What kind of cipher did Mary, Queen of Scots use?
A nomenclator: a substitution alphabet with extra symbols for common words and names, plus a few null marks meant to confuse anyone who intercepted it. It was far more elaborate than a simple Caesar shift, but still open to frequency analysis.
Who broke Mary, Queen of Scots' code?
Thomas Phelippes, the codebreaker working for Elizabeth's spymaster, Sir Francis Walsingham. He deciphered Mary's letters using frequency analysis, often within hours of intercepting them.
Why was Mary, Queen of Scots executed?
She was convicted of treason for approving the Babington plot to assassinate Elizabeth I. Her own enciphered reply, decoded by Walsingham's team, was the central evidence. She was beheaded at Fotheringhay Castle on 8 February 1587.
How did breaking the cipher lead to Mary's execution?
Her decoded reply to Anthony Babington endorsed the plan to kill Elizabeth. That coded approval, read aloud in plain English at her trial, became the evidence that convicted her of treason.
Is the Babington cipher hard to solve today?
Not very. A nomenclator resists casual guessing, but frequency analysis and modern tools take this class of cipher apart quickly. What cost Phelippes hours in 1586 can take minutes today.
Last updated June 30, 2026