Encrypt & Decrypt Text
Encrypt text with AES or RSA using a passphrase, your own key or a freshly generated one. Everything happens in your browser.
The key is derived with PBKDF2-SHA256 (600,000 iterations) and a random salt. Decrypt with the same passphrase and key length.
Keys and passphrases never leave this page. Save your key: without it, encrypted data cannot be recovered.
Which algorithm should I use?
AES-GCM is the right choice for almost everything: it encrypts and also detects any tampering or a wrong key. AES-CBC and AES-CTR are included for compatibility with older systems; they do not detect changes to the data. RSA-OAEP lets anyone with your public key encrypt a short message that only your private key can decrypt. It is limited to about 190 bytes with a 2048-bit key (318 bytes at 3072, 446 at 4096), so it is normally used to encrypt an AES key rather than the message itself.
Output format
The output is Base64 so it is easy to copy and paste. With your own key it contains the IV followed by the ciphertext; with a passphrase it starts with the 16-byte PBKDF2 salt. The IV is 12 bytes for AES-GCM (the 16-byte authentication tag is at the end of the ciphertext) and 16 bytes for AES-CBC (PKCS#7 padding) and AES-CTR (counter block, 64-bit counter). RSA output is the raw RSA-OAEP ciphertext using SHA-256. This lets you decrypt the data with OpenSSL, Python, Java or Node using the same parameters.
Frequently asked questions
Is this safe to use for real secrets?
The encryption uses the Web Crypto API built into your browser, the same audited code browsers use for HTTPS. Keys are generated with a cryptographically secure random generator and nothing is sent to a server. As with any tool, the security depends on keeping your key or passphrase secret and choosing a strong passphrase.
What is the difference between a passphrase and a key?
A key is 128 or 256 random bits used directly by AES. A passphrase is text you can remember; it is turned into a key with PBKDF2, which is deliberately slow so that guessing passphrases is expensive. A long random key is stronger than a typical passphrase.
Can I use my own RSA keys?
Yes. Paste a PEM public key (SPKI, "BEGIN PUBLIC KEY") and private key (PKCS#8, "BEGIN PRIVATE KEY"). Keys in the older "BEGIN RSA PRIVATE KEY" format can be converted with openssl pkcs8 -topk8 -nocrypt -in key.pem.
Why does decrypting give an error?
The algorithm, key (or passphrase and key length) must match the ones used to encrypt, and the Base64 data must be complete. AES-GCM refuses to decrypt if even one character was changed.