HomeGuides › Encrypt a file

How to password-protect a file

Encrypting a file before you email it or put it on a USB stick means the password, not the transport, is what protects it.

Encryption turns a file into something unreadable without the password. Done properly it is very strong; done carelessly it produces something that looks encrypted and is not. The difference is entirely in the details, so it is worth knowing what this tool does.

Step-by-step

  1. Choose the file. It is read in your browser and nothing is uploaded.
  2. Enter a password. This is the whole of your security. See below.
  3. Decide whether to keep the filename. Off by default, because a filename is often the most revealing thing about a document.
  4. Encrypt, and save the result. You get a .tfenc file.
  5. Test it before you delete the original. Decrypt the result once, on this page, and confirm you get your file back.

What is actually done

Your password is not used as a key. It is put through PBKDF2-HMAC-SHA-256 with 600,000 iterations and a fresh 16-byte random salt, which is what turns a memorable phrase into key material and makes guessing expensive. The file is then encrypted with AES-256-GCM under a fresh 12-byte nonce.

GCM is an authenticated mode, which matters more than it sounds: it does not merely hide the contents, it detects tampering. The container's header — version, iteration count, salt, nonce — is fed in as additional authenticated data, so altering any of it makes decryption fail rather than silently succeed with different parameters.

None of this is invented here. Every primitive is the implementation already built into your browser.

Your password is the weak point

AES-256 will not be broken. A five-character password will, quickly, by trying every five-character password. The 600,000 iterations make each guess slow, which buys a great deal against a weak password and is not a substitute for a strong one.

Use a passphrase of five or six random words for anything that matters. If you lose it, the file is gone — there is no recovery, no reset, and no back door. That is the point.

What it does not hide

The size of your file is visible to anyone who has the encrypted copy, because ciphertext is essentially the same length as the plaintext. The fact that you encrypted something is visible too. If the filename matters, leave the "store the filename" option off.

Frequently asked questions

Is the file uploaded to be encrypted?

No. Everything happens in your browser, using its built-in cryptographic implementation. There is no server involved and no upload step.

What happens if I forget the password?

The file cannot be recovered. There is no reset and no recovery key. Write the password down somewhere safe, or store it in a password manager, before you rely on the encrypted copy.

Can the recipient open it without this site?

The container format is documented on the tool's page, so it can be decrypted by any code implementing it. In practice the simplest route is to send them the link to the same page — it works offline once loaded, and their file is not uploaded either.

Is this the same as a password-protected ZIP?

It is considerably stronger than legacy ZIP encryption, which is broken. Modern AES-based ZIP encryption is comparable in principle, but implementations vary and many tools still default to the old scheme.

Open file encryption →