One-Time Pad / Vernam Cipher
Encrypt or decrypt letters with an equal-length key, securely generate a random pad in your browser, and inspect every modulo-26 step.
Key and formatting Show options
One-time key
How the key works: Each A–Z letter in your message uses one A–Z key letter. Spaces, punctuation and numbers do not use key letters.
- Message
HELLO- Key
XMCKL- Result
EQNVZ
Enter your own key for demonstrations, or generate a random key for a genuine one-time pad. A secure key must remain secret and never be reused.
Formatting options
Grouped output uses uppercase letters only and removes punctuation, numbers and whitespace.
Input text
Output text
Calculation steps
| # | Plain | Value | Key | Value | Calculation | Cipher |
|---|
Showing the first 120 letter calculations.
Cipher properties
Using This Tool: Guide & Notes Show guide
The one-time pad combines each message letter with one key letter using modulo-26 arithmetic. This tool demonstrates the alphabetic method, validates the pad length, and can generate a cryptographically random key locally in your browser.
How to use it
- Choose Encrypt for plaintext or Decrypt for ciphertext, then enter the message in the input box.
- Enter a pad containing at least one A–Z letter for every message letter, or use Generate secure key to create the required number of random letters in your browser.
- Read the output and inspect Calculation steps to see the value, key letter, modular equation, and result for each supported character.
- Use Swap input/output to reverse the current result with the same pad, or copy the input and output when you need them elsewhere.
Options and settings
- Preserve case keeps the visible uppercase or lowercase style of each transformed input letter.
- Keep punctuation and numbers carries non-letter characters through without consuming key letters.
- Remove whitespace creates compact output while leaving the underlying letter calculations unchanged.
- Group letters produces uppercase A–Z blocks and removes punctuation, numbers, and whitespace; the stepper sets groups from 2 to 12 letters.
- Trim to length removes unused key letters. Extra key letters are ignored, but a short key prevents output.
Notes
- Perfect secrecy requires a uniformly random key at least as long as the plaintext, delivered securely, kept secret, and used for exactly one message.
- Reusing any part of a one-time pad can expose relationships between messages and destroy its defining security guarantee.
- This is an alphabetic modulo-26 teaching model. Historical Vernam systems and modern digital data are often described with binary XOR instead.
- The key is generated and processed locally. The tool does not store, transmit, or recover lost pads.
One-Time Pad: The Cipher That Cannot Be Broken
How a random key as long as the message turned simple addition into cryptography’s rarest promise—perfect secrecy—and why one reused page can bring the whole system crashing down.