One-Time Pad Encrypt / Decrypt Tool
Encrypt or decrypt text with a one-time pad (XOR cipher). Generate a cryptographically random key via WebCrypto, view hex/base64 output, and verify the round-trip.
Encrypt
Ciphertext — Hex
Ciphertext — Base64
Key used (hex)
Decrypt
Recovered Plaintext
How it works: Each plaintext byte is XOR-ed with a matching key byte.
The key is generated by
crypto.getRandomValues() (WebCrypto) — no server contact, no storage.
Keep the key secret; lose it and the ciphertext is unrecoverable.
Copied!
Summary
Encrypt or decrypt text with a one-time pad (XOR cipher). Generate a cryptographically random key via WebCrypto, view hex/base64 output, and verify the round-trip.
How it works
- Type or paste your plaintext into the message field.
- Click "Generate Key" to create a cryptographically random key (same byte length as your message) via WebCrypto.
- Click "Encrypt" — each message byte is XOR-ed with the matching key byte; ciphertext appears in hex and base64.
- To decrypt, paste the ciphertext (hex or base64) and the original key, then click "Decrypt" to recover the plaintext.
- The round-trip indicator confirms the decrypted output matches the original message.
Use cases
- Demonstrate perfect secrecy in a cryptography class or tutorial.
- Encrypt short secrets offline without any server round-trip.
- Test XOR-cipher logic during security research or CTF challenges.
- Generate and exchange a one-time pad key for manual secure messaging.
Frequently Asked Questions
Last updated: 2026-07-01 ·
Reviewed by Nham Vu