keepfileslocal

password-protect a PDF

Put a password on a document with AES-256 encryption. The file and the password both stay on this machine, which is the only arrangement that makes sense for this particular job.

There is no Google Drive or Dropbox button on purpose: those send the file through a server. Here is what happens instead.

in three steps

  1. Drop the PDF in, or choose it. A document that already has a password says so and is left alone.
  2. Type the password twice. It is checked here, in the page, and never leaves the machine you typed it on.
  3. Protect, and the file comes back encrypted. Nobody here can recover that password for you.

how it works

The document is encrypted with AES-256, which is the strongest scheme the PDF format defines. Your password is what derives the key, so from that moment the contents of the file are unreadable without it — not hidden behind a prompt that a determined reader can walk around, but genuinely unreadable.

The encryption is done by qpdf, a long-standing PDF implementation compiled to WebAssembly and run in a worker inside this tab. It is fetched from this site the first time you press the button, and the worker is thrown away as soon as the file is written, which takes your password with it.

That also means nobody here can undo it. There is no reset link and no support address that can help: the password is not stored anywhere for anyone to look up.

why doing this locally matters here

This is the tool where uploading defeats the purpose most completely. To have a website protect a document for you, you have to give that website the unprotected document and the password meant to guard it, in the same request, from the same person. Whatever happens next, you have already handed over both halves.

And the documents people password-protect are exactly the ones that make that a bad trade: a contract before it is signed, a payslip, a medical letter, the spreadsheet of somebody else's data that has to go out by email. The file never leaves this tab, so there is no request to trust.

two kinds of PDF password

A PDF can carry a user password, which is needed to open the file at all, and an owner password, which leaves the file readable but marks it as not to be printed, copied or edited. This tool sets the first one, and sets it as both, so that the document simply will not open without it.

It deliberately does not offer the second on its own. Those restrictions are a request to whichever program opens the file: most readers honour them, some do not, and any reader could choose not to. Offering them as protection would be selling a sign as a lock. If what you need is for a passage not to be readable, redact it, which removes the text rather than asking politely.

questions

Where does my PDF go, and where does the password go?

Neither goes anywhere. The encryption runs in your browser, so the document and the password are only ever in this tab's memory. The job log counts the requests the page made while working and how many of them left this site; the second number is zero, which your browser's network panel will confirm.

Why does it matter that this one runs locally?

Because of what you would otherwise be uploading. A site that password-protects your PDF for you receives the unprotected document and the password meant to guard it, in the same session, from the same person. Whatever the promise on the page, that is the moment the protection stops being yours.

How strong is the encryption?

AES-256, which is the strongest the PDF format defines and what qpdf writes here. That part is not the weak link. Your password is: a short or guessable one can be tried against the file for as long as somebody cares to keep trying, on their own machine, with no rate limit.

Can I stop people printing or copying from the document?

The PDF format has flags for that and this tool does not set them, on purpose. They are a request to whichever program opens the file, not a lock: most readers obey them, some ignore them, and a tool on this site is not going to hand you something that only looks like protection.

What if I forget the password?

Then the document is gone, and not because of a policy — nobody can recover it, here or anywhere, because the password is what derives the key the file was encrypted with. That is the whole point of it. Write it down somewhere before you close the tab.

next