Security Tools

Encrypt & decrypt.

Password-protect text or a file with AES-256-GCM, derived from your passphrase with PBKDF2 at 600,000 iterations — the current OWASP-recommended minimum. Everything runs locally via the browser's Web Crypto API; nothing is uploaded.

How to encrypt and decrypt with a passphrase

  1. Pick Encrypt or Decrypt at the top of the tool.
  2. Type or paste your text, or choose a file. If you choose a file it takes priority over the text box.
  3. Enter a passphrase. Longer is stronger, and a few unrelated words beat a short word with symbols.
  4. Press the button. Encrypted text can be copied or saved, and an encrypted file downloads with the data protected.
  5. To read it later, switch to Decrypt, supply the encrypted text or file and the same passphrase.

What is happening under the hood

Your passphrase is stretched into a key with PBKDF2 and 600,000 iterations, and the data is sealed with AES-256-GCM. A fresh random salt and nonce are made every time, so encrypting the same message twice gives two different results. GCM is an authenticated mode: a wrong passphrase or a modified file is detected and refused rather than returning garbage.

Why your text and passphrase stay private

An encryption tool is only worth using if the secret never leaves your machine. The work runs through the Web Crypto API inside an isolated frame on this page. That frame is cut off from the network, so your message, file and passphrase cannot be transmitted by the page or by anything else on it. The advertising on this page loads outside the frame and has no view into it.

Before you rely on it

Related jobs

Use the passphrase generator and strength checker beside this page to choose a strong passphrase before you encrypt.

How it works

What this tool does

You give it text or a file and a passphrase. It returns an encrypted version that nobody can read without the same passphrase. Everything happens in your browser through the Web Crypto API, so the text, the file and the passphrase are never uploaded. Encrypted text comes out as a single Base64 string you can paste into a message or a note. An encrypted file downloads with a .enc extension. To get the original back, switch to Decrypt, supply the same passphrase and paste the string or choose the file.

How the encryption is built

  1. A key is derived from your passphrase. The tool uses PBKDF2 with HMAC-SHA-256 and 600,000 iterations, with a fresh random 16-byte salt every time. OWASP's Password Storage Cheat Sheet gives 600,000 as the work factor for PBKDF2-HMAC-SHA256. The iterations make each passphrase guess slow for an attacker, and the salt makes sure the same passphrase never produces the same key twice.
  2. The data is encrypted with AES-256-GCM. GCM is an authenticated mode: it produces a 16-byte authentication tag (the Web Crypto default of 128 bits) along with the ciphertext. On decryption, a wrong passphrase or any change to the data fails the check and no output is produced.
  3. A fresh 12-byte IV is generated for every encryption. The AES-GCM specification recommends a 96-bit IV, and MDN notes that an IV must never be reused with the same key. Random IV and salt are why encrypting the same text twice gives two different results.
  4. Everything needed to decrypt is packed into the output. The container is the salt (16 bytes), the IV (12 bytes) and then the ciphertext with its tag. The salt and IV are not secret, so only the passphrase has to be kept.

Worked example

Encrypt the five-character text hello with a passphrase. The plaintext is 5 bytes, GCM adds a 16-byte tag, the salt adds 16 bytes and the IV adds 12 bytes, so the container is 5 + 16 + 16 + 12 = 49 bytes. Base64 turns every 3 bytes into 4 characters, so 49 bytes become 68 characters. Run it again and you get a different 68-character string, because the salt and IV are new. Both decrypt back to hello with the same passphrase. Change a single character of either string and decryption fails with no partial output. Note what the example shows: the output is always 44 bytes longer than the input, so the length of what you encrypted is not hidden.

Choosing a passphrase

The encryption is not the weak point; the passphrase is. Anyone who has the output can guess passphrases offline, limited only by the 600,000-iteration key derivation. A short or common passphrase will fall to a dictionary, so use a long random one. A six-word Diceware passphrase is about 77 bits when drawn from the full 7,776-word list. You can generate one with the Diceware Passphrase Generator and measure it with the Password Entropy Calculator. There is no reset: if you forget the passphrase, the data cannot be recovered.

What it is good for, and what it is not

Common mistakes

Common mix-ups

  1. NIST SP 800-132: Password-Based Key Derivation, Part 1

Checked against these sources on .

Frequently asked questions

Is it safe to encrypt text in the browser?

The encryption uses the browser's built-in Web Crypto implementation of AES-256-GCM, and the text, file and passphrase are not sent anywhere. The remaining risks are a weak passphrase and an untrustworthy device. For high-stakes files, use a vetted encryption program as well.

What encryption does this tool use?

AES-256 in Galois/Counter Mode, with the key derived from your passphrase by PBKDF2-HMAC-SHA256 at 600,000 iterations. A random 16-byte salt and a random 12-byte IV are created for each encryption.

Why does the same text give a different result each time?

Each encryption uses a new random salt and IV. That is required for AES-GCM: the IV must never repeat with the same key. Every output still decrypts to the same text with the same passphrase.

What happens if I forget the passphrase?

The data cannot be recovered. There is no reset and no backup key, because the passphrase is the only secret. Store it in a password manager or somewhere safe before relying on the output.

Why does decryption fail with the right passphrase?

The output was probably altered. GCM authenticates the data, so a missing character, an added line break or a truncated file will fail the check. Copy the whole string again, or use the original file.

Can I encrypt large files?

The tool reads the file into browser memory and encrypts it in one operation, so very large files may be slow or fail on devices with little memory. Encrypt large archives with a desktop program instead.

How strong does my passphrase need to be?

As strong as the secret deserves, since anyone holding the output can try guesses offline. A random passphrase of six or more words from a 7,776-word list is a common minimum. The 600,000 PBKDF2 iterations slow guessing but do not rescue a weak passphrase.

Sources

Advertisement
Advertisement