Encrypt and Decrypt Text
HG-22Type a passphrase, a line with only =====, then your text, and press Encrypt to get a Base64 string. Paste that string back under the same passphrase and press Decrypt.
Runs in your browser. Nothing is uploaded.
Passphrase, then a line with only =====, then the text to encrypt (or the Base64 text to decrypt)
Result
How to use it
- Write the passphrase on the first line, then a line with only =====, then the text to encrypt. Sample shows the layout.
- Press Encrypt. The result is one Base64 string that holds the salt, the IV and the ciphertext.
- To read it later, write the same passphrase, the ===== line, then the Base64 string, and press Decrypt.
- Copy the Base64 result somewhere safe. There is no way to recover the text if you lose the passphrase.
Exactly what the output contains
The Base64 output is three things joined together: a random 16-byte salt, a random 12-byte IV, and then the AES-256-GCM ciphertext followed by its 16-byte authentication tag. The key is made from your passphrase, read as UTF-8, with PBKDF2-HMAC-SHA-256, 600,000 iterations and that salt. Salt and IV are fresh each time, so encrypting the same text twice gives different strings, and both still decrypt with the same passphrase.
What it protects and what it does not
GCM checks integrity as well as hiding the text, so a wrong passphrase or any changed character produces an error instead of garbled output. The strength depends on your passphrase: a long, unique phrase is far better than a short word. This is a format of its own, so it will not open output from other encryption tools, and it does not handle files or keys. The page does not store anything, and there is no recovery if you forget the passphrase.
Careful with share links
The passphrase sits in the same input box as the text. Share links on this site keep the input in the URL fragment, which means a link made from this page would contain your passphrase. Do not share a link from this tool. Copy the Base64 result instead and pass the passphrase to the other person through a different channel.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Could not decrypt: the passphrase is wrong, or the text was changed or is not from this tool. | The authentication check failed. | Check the passphrase for typos, and paste the whole Base64 string with no characters missing. |
Put the passphrase first, then a line with only =====, then the text to encrypt. | The separator line is missing. | Add a line holding only five equals signs between the passphrase and the text. |
The text to decrypt is not valid Base64. Paste the whole output of Encrypt. | The part after the ===== line is not Base64. | Paste the full string that Encrypt produced. |
Questions people ask
How do I encrypt text with a password online?
Write the password on the first line, then a line with only =====, then the text, and press Encrypt. You get a Base64 string. The work is done by your browser using AES-256-GCM, and the text and password are not sent anywhere.
How do I decrypt the text again?
Write the same passphrase, a line with only =====, then the Base64 string, and press Decrypt. If the passphrase is wrong or the string was altered, you get an error rather than wrong text, because GCM checks authenticity.
Which encryption does it use?
AES-256 in GCM mode through your browser's Web Crypto. The key comes from PBKDF2-HMAC-SHA-256 with 600,000 iterations and a random 16-byte salt, and each message gets a random 12-byte IV. The output holds salt, IV, ciphertext and tag.
Can I decrypt it with another tool?
Not easily. The layout (salt, IV, ciphertext and tag, then Base64) and the key derivation are described on this page, so you could write code to open it, but off-the-shelf tools expect their own formats and will not read this output directly.
Why is the output different each time I encrypt the same text?
A new random salt and IV are generated for every encryption. That is deliberate: it stops two messages with the same text from looking alike. Every one of those different outputs still decrypts to the same text with your passphrase.
About this tool
Write the passphrase, then a line holding only =====, then the text. Encrypt turns the text into Base64 made of three parts in this order: a random 16-byte salt, a random 12-byte IV, then the AES-256-GCM ciphertext followed by its 16-byte authentication tag. The key comes from the passphrase (as UTF-8) with PBKDF2-HMAC-SHA-256, 600,000 iterations and that salt. Decrypt reads the same layout, so you need the exact passphrase and the whole output; a wrong passphrase or any changed character fails with an error instead of returning garbage. Salt and IV are fresh each time, so encrypting the same text twice gives different output. This is a format of its own: it will not decrypt output from other tools, and it will not open files or keys. It is only as strong as the passphrase, and there is no recovery if you forget it. The passphrase, the text and the result are never sent anywhere or stored. Because the passphrase sits in the same box, the page URL fragment of a share link would contain it, so do not share a link made from this tool.