Guide · AI tools
Cryptography AI solver: what ChatGPT and Claude can crack, with prompts
Chatbots solve Caesar, Atbash and Morse almost every time, Vigenère almost never and AES not at all. Prompts that make the AI run the real attack in code.
The short version
- In a 2025 benchmark Claude 3.5 Sonnet decrypted Caesar exactly 98% of the time with no key and no examples.
- The same model got Vigenère right 1% of the time, and AES and RSA 0%: AI does not break modern encryption.
- Telling a reasoning model which cipher it is raised DeepSeek-R1's CipherBank score by 31.81 points.
- The reliable trick for puzzles is to make the chatbot run frequency analysis or a brute force in code, not guess the plaintext.
In this article · 5 sections
A chatbot is a good solver for the ciphers everyone has seen: Caesar, Atbash and Morse come back right nearly every time. It is a bad solver for anything that needs careful letter-by-letter work with an unknown key, such as Vigenère or Playfair, and it gets nowhere near modern encryption like AES or RSA. For puzzles the fix is simple: don't ask the model to guess the plaintext. Ask it to write and run the classical attack in code. The prompts for that are below.
We haven't run our own benchmark for this piece. The numbers come from two published studies, and at the end there is a short test you can repeat in five minutes.
What the benchmarks show
The clearest numbers are in a 2025 cryptanalysis benchmark. The authors encrypted texts with nine methods and asked models to decrypt them without being given the key. Scores are exact match, so 98% means 98% of texts came back perfect.
| Cipher | Claude 3.5 Sonnet (no examples) | GPT-4o (no examples) | GPT-4o (with examples) |
|---|---|---|---|
| Caesar (shift 3) | 98% | 66% | 90% |
| Atbash | 92% | 12% | 17% |
| Morse | 96% | 81% | 86% |
| Rail Fence | 0% | 0% | 1% |
| Vigenère | 1% | 1% | 3% |
| Playfair | 0% | 0% | 0% |
| RSA | 0% | 0% | 1% |
| AES | 0% | 0% | 0% |
The pattern is the one the authors name: models decrypt mainly the ciphers that are common in their training data. Caesar with shift 3 is in thousands of textbooks and forum posts. Vigenère with an unknown key needs the model to find a key and then apply it exactly, letter by letter, and it can't.
CipherBank, published at ACL Findings 2025, made it harder: 2,358 problems where the model gets three plaintext and ciphertext pairs and has to work out the rule itself. The best overall scores were 45.14 for Claude-Sonnet-3.5 and 40.59 for o1. On Vigenère even o1 managed 7.25%. Even ROT13 was not a sure thing: Claude-Sonnet-3.5 got 83%, GPT-4o 26–38% depending on the version.
Two findings from CipherBank are useful when you prompt:
- Naming the cipher helps reasoning models a lot. When told which algorithm was used, DeepSeek-R1 gained 31.81 points and o1-mini 14.49. Chat models gained much less (Claude 5.30 points, Gemini 1.97).
- Models cheat with meaning. A common error was swapping in a synonym: the model guesses a plausible sentence instead of applying the cipher. Names often came out wrong, scores dropped when digits were encrypted too, and adding noise dropped Claude's score from 59.17 to 25.08.
These studies tested 2024 and early 2025 models. Newer reasoning models are likely better at the easy end, but we found no newer published benchmark, so treat the table as the floor, not the current state.
Can AI crack real encryption?
No. AES, the standard behind your browser, your phone and your Wi-Fi, uses keys of 128, 192 or 256 bits. A 128-bit key has 2^128 possibilities, and a language model doesn't change that arithmetic. It can't "see" the plaintext in random-looking bytes, which is why every model in the benchmark scored 0% on AES.
What AI can do with modern crypto is explain it, help you write code that uses it correctly, or spot a mistake in how someone else used it (a hard-coded key, a reused nonce). That's code review, not cracking.
Prompts that work: make the AI run code
The model is unreliable when it tracks letters in its head. It is reliable when it writes a short Python script and runs it, because then the computer applies the cipher, exactly. Use a chatbot that can execute code, and paste your ciphertext where it says so.
Step 1: identify the cipher before solving it. This is the CipherBank lesson: a model that knows the algorithm does much better.
Here is a ciphertext. Do not guess the plaintext yet.
Use Python to compute: letter frequencies, the index of coincidence, the length, which characters appear (letters only, digits, dots and dashes, pairs), and whether word lengths look preserved.
Then list the 3 most likely classical ciphers (Caesar/ROT13, Atbash, simple substitution, Vigenère, transposition, Morse, Base64, Bacon) and say which measurement points to each.
Ciphertext:
[PASTE HERE]
An index of coincidence near 0.066 means a single-alphabet cipher (Caesar, Atbash, substitution, or a transposition) on English text. Closer to 0.038 points to a multi-alphabet cipher such as Vigenère.
Step 2a: Caesar or ROT13. Don't let it pick a shift by intuition. Make it print all 25.
Write and run Python that decrypts this text with every Caesar shift from 1 to 25.
Score each result with English letter frequencies (chi-squared), print all 25 with their scores, and show the best one.
Do not correct spelling or change any words in the output.
Ciphertext:
[PASTE HERE]
Step 2b: simple substitution. Each letter maps to a different letter, so there are far too many keys to try them all. The standard attack is hill climbing with English letter statistics. Free solvers like quipqiup solve the same kind of cipher.
This looks like a simple substitution cipher. Write and run Python that solves it by hill climbing: start from a key based on letter frequency, swap two letters at a time, keep the swap if an English quadgram or bigram score improves, and restart 20 times from random keys.
Print the best key as a 26-letter mapping and the full decryption. Then list any letters whose mapping you are not sure about.
Ciphertext:
[PASTE HERE]
Step 2c: Vigenère. This is where chatbots fail on their own and code wins, as long as the text is long enough. A few hundred letters is a good working amount; a one-line Vigenère is often unsolvable for anyone.
This looks like a Vigenère cipher. Write and run Python that:
1. estimates the key length with the index of coincidence for lengths 2 to 20 (and Kasiski repeats as a check),
2. for the best 3 lengths, finds each key letter by chi-squared against English frequencies,
3. decrypts with each candidate key and prints the key and plaintext.
Apply the key exactly. Do not fix words that look wrong; tell me where they are instead.
Ciphertext:
[PASTE HERE]
The line "do not fix words" matters. It counters the synonym habit CipherBank found: if the output has a garbled word, you want to see it, because it usually means one key letter is wrong.
When to skip the chatbot
For many puzzles a dedicated tool is faster and doesn't hallucinate. CyberChef, made by GCHQ, is free, open source under Apache 2.0, and runs entirely in your browser, so your text isn't sent to a server. It handles ROT13, Base64, XOR, Morse and dozens of other encodings. quipqiup solves newspaper-style substitution ciphers.
A good split: CyberChef or quipqiup for the known ciphers, a chatbot with code for the odd cases, where it helps that you can describe the puzzle in plain words ("the hint mentions a clock, the ciphertext is pairs of digits").
AI models do find patterns in made-up ciphers when they get an example. In OpenAI's o1 launch post, the model was given one plaintext and ciphertext pair and worked out that each pair of letters stood for one letter, the average of their alphabet positions. The pair it was shown was "oyfjdnisdr rtqwainr acxz mynzbhhx" → "Think step by step". It then decoded a new ciphertext as "THERE ARE THREE R'S IN STRAWBERRY", which GPT-4o could not do. If your puzzle comes with a solved example, include it.
Use this on puzzles, CTF challenges, geocaches and your own data. Breaking into someone else's messages is a different matter, and modern encryption puts it out of reach of these tools anyway.
A five-minute test you can repeat
Paste this Caesar ciphertext into a chatbot with no other context: PHHW PH DW WKH ROG PLOO (shift 3, the answer is "meet me at the old mill"). Most current models should get it. Then encrypt a paragraph of your own with Vigenère in CyberChef, using a key of six or more letters, and ask the same model to solve it, first with no instructions and then with the Step 2c prompt. That comparison shows the gap between guessing and computing better than any table.