Last updated October 10, 2026 · Report an error
The one-time pad is the only classical cipher proven to be mathematically unbreakable — but only when used exactly as intended: with a truly random key, at least as long as the message, used exactly once and never reused.
This tool encrypts or decrypts text using a one-time pad with a key you provide, and it enforces the key-length rule that makes the cipher secure in the first place.
How it works
Enter your text and a key of letters. Each letter's position (A=0 ... Z=25) is added to the matching key letter's position, wrapping mod 26, to encrypt — or subtracted to decrypt. Unlike a Vigenère cipher, the key is never repeated or wrapped around: this tool requires the key to have at least as many letters as your message, and will tell you if it's too short rather than silently reusing it.
- Enter mode.
- Enter text.
- Enter key (at least as long as your text, letters only).
- Click Calculate to see your results.
Examples
A 12-letter message and a 12-letter key
"ATTACKATDAWN" encrypted with the key "XMCKLARBIQPT" (also 12 letters) produces ciphertext that reveals nothing about the message without that exact key.
Who should use it
- Teaching the mathematical concept of information-theoretic (provable) security.
- Puzzle and cryptography-education contexts exploring why "unbreakable" ciphers are hard to use in practice.
Industry applications
- Cryptography education and theory
- Historical diplomatic and intelligence communications
Advantages
- The only classical cipher with a mathematical proof of unbreakability, when used correctly.
- Simple arithmetic (modular addition) once you have a proper key.
Limitations
- Requires a truly random key at least as long as the message — genuinely impractical for most real-world use.
- Any key reuse completely destroys its security guarantee.
Common mistakes to avoid
- Providing a key shorter than the message and expecting it to work — real one-time pad security depends on never repeating key material.
- Reusing the same key for multiple different messages, which breaks the security guarantee entirely.
Best practices
- Generate your key from a genuinely random source (not a memorable phrase) if you want to explore the real security properties of a one-time pad, not just its arithmetic.
- Never reuse a one-time pad key across more than one message.
Tips
- If you want to see genuinely unbreakable encryption in action, generate your key using a random source completely unrelated to your message — a memorable phrase as a "key" undermines the whole point.