Text Encryptor
Encrypt and decrypt a message with a password using AES-GCM in your browser, with an honest account of what this does and does not protect you from.
Encrypt the same text twice — the output should differ
That is the one check anyone can run on a tool like this, and it is the check that matters. Encrypt a message, encrypt the identical message again, and compare the two outputs. If they match, the tool is reusing its nonce, and that is a serious problem rather than a cosmetic one.
AES-GCM works by generating a keystream from the key and a nonce — a number used once — and combining it with your message. Reuse the nonce with the same key and two things follow. The obvious one is that identical messages produce identical output, so an observer can see you sent the same thing twice without decrypting anything.
The second is much worse. Both messages get the same keystream, so combining the two outputs cancels it out completely and leaves the two original messages combined with each other. Encrypting "attack at dawn" and "attack at dusk" under a repeated nonce and combining the results gives exactly this:
0000000000000000000000140405
That is byte-for-byte the two plaintexts combined — no key was recovered, and none was needed. The 11 leading zeros say the two messages share their first 11 characters, which is already a real leak. And two messages combined this way are separable with ordinary language statistics; if an attacker knows or guesses one of them, they get the other exactly.
This tool generates a fresh 12-byte nonce and a fresh 16-byte salt for every single encryption, so the same input produces different output every time — verified on each build, along with the control that a fixed nonce really does reproduce the leak above. The nonce is not a secret, incidentally, and does not need to be: it is stored in the clear alongside the ciphertext. It only needs to be different every time.
What the extra bytes are for
The output is always longer than the input by a fixed amount, whatever the message length:
| Message | Ciphertext | Overhead |
|---|---|---|
| 1 bytes | 17 bytes | 16 |
| 10 bytes | 26 bytes | 16 |
| 100 bytes | 116 bytes | 16 |
| 1,000 bytes | 1,016 bytes | 16 |
Those 16 bytes are an authentication tag, and they buy something specific: tampering is detected rather than silently producing different text. Flip a single bit anywhere in the ciphertext and decryption fails outright instead of returning plausible-looking garbage. Without it, an attacker who cannot read your message can still change it, which is often the more dangerous of the two.
The other cost is deliberate slowness. Your passphrase is not used as a key directly — it is stretched through 150,000 rounds of PBKDF2 first, which makes guessing 150,000 times more expensive per attempt. That is why encrypting takes a noticeable moment, and the moment is the feature.
Being straight about the limits, though: none of this rescues a weak passphrase. Key stretching multiplies the attacker's cost by a constant; a short or common passphrase divides it by very much more. This is a reasonable way to put something in a text file or an email that a casual reader should not see. It is not a reason to trust a three-word password with anything that would genuinely hurt to lose.
How to use
- Enter your message and choose a strong password.
- Encrypt, then copy the result.
- Send the ciphertext and the password by separate routes.
- Decrypt by pasting the ciphertext and entering the same password.
Frequently asked questions
How strong is this?
The cipher itself is AES-GCM with a key derived from your password, which is the same standard used to protect classified material and is not the weak point. Your password is. A short or guessable password can be attacked offline at enormous speed, and no cipher can compensate for that.
What makes a password strong enough here?
Length far more than complexity. A passphrase of four or five unrelated words is both easier to remember and harder to attack than a short string of substituted symbols. Anything you have used elsewhere is unsuitable, since it may already be in a breach list.
Does my message get sent anywhere?
No. Encryption and decryption happen entirely in your browser using the built-in Web Crypto API, so neither the message nor the password leaves your device. You can disconnect from the network and it will still work.
How should I share the password?
By a different channel from the ciphertext. Sending both in the same email or chat defeats the point entirely, since anyone reading that channel has both halves. Speaking it aloud, or using a separate messaging service, keeps the two apart.
Is this suitable for protecting something genuinely sensitive?
For casual confidentiality, yes. For material where the consequences of exposure are serious, use a purpose-built, audited tool — a password manager, an encrypted messenger, or full-disk encryption. A browser page is a reasonable convenience, not a considered security architecture, and the difference matters when the stakes are real.
What happens if I forget the password?
The message is unrecoverable. That is the intended behaviour of encryption working correctly — there is no reset, no back door and no recovery process. Store the password somewhere durable before you need it.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.