DEV Community

Cover image for ๐Ÿ”’ Protect PDF: Encrypt with a password โ€” locally, so the file never travels
Tomaz
Tomaz

Posted on Originally published at tooladda.online

๐Ÿ”’ Protect PDF: Encrypt with a password โ€” locally, so the file never travels

โšก 10-second version

Drop the PDF into tooladda.online/pdf-password-protector.html, set a password, download the encrypted file. Neither the document nor the password ever leaves your browser.

โ— Important

Think about what an online "protect PDF" service actually receives: your confidential document and the password you chose for it, together, in one request. That's the whole reason this runs client-side.


๐Ÿ”‘ Two different passwords โ€” and only one of them is real security

Every PDF supports two, they do completely different things, and confusing them is the commonest mistake here.

User password (open password) Owner password (permissions password)
Needed to Open the file at all Change the restrictions
Content encrypted? โœ… Yes โ€” the bytes are unreadable without it โš ๏ธ Content is encrypted with a known empty user password
Blocks reading โœ… Yes โŒ No โ€” the file opens freely
Blocks printing / copying Via permissions, once open Supposed to โ€” but only advisory
Enforced by Cryptography The honour system of the PDF reader

โš ๏ธ Warning

Permissions are advisory. "Do not allow printing" and "do not allow copying" are flags in the file that a well-behaved reader chooses to respect. Plenty of readers and libraries simply ignore them, and there is no cryptography stopping them. If content must not be extracted, an owner password will not achieve that.

Only the user password provides actual protection. If it matters, set a user password.

And the password is the whole security

Encryption strength is irrelevant if the password is invoice2024. The file's protection is exactly as strong as the password, and an attacker with the file can guess offline at whatever rate their hardware allows โ€” no rate limiting, no lockout.

Use the password generator for something with real entropy, and โ€” this matters โ€” send the password through a different channel than the file. Emailing an encrypted PDF and its password in the same thread protects you from nothing at all.


๐Ÿงญ How it works

Diagram


โœจ What's inside

### ๐Ÿ” Real encryption, done locally The PDF is genuinely encrypted in your browser. No upload means no window where your document and its password sit together on someone else's machine. ### ๐ŸŽ›๏ธ Permission flags Set print, copy and edit restrictions โ€” with an honest note that readers may ignore them, which most tools won't tell you.
### ๐Ÿ”‘ Both password types explained Choose deliberately between "can't open" and "can open but restricted", instead of picking whichever box appeared first. ### ๐Ÿšซ Nothing stored No account, no history of protected files, no copy of your password anywhere.

๐Ÿ› ๏ธ Real jobs

Situation Which password
๐Ÿฆ Emailing a bank statement User password โ€” must not open without it
๐Ÿ“„ Sending an offer letter User password, shared over a different channel
๐Ÿงพ Invoice to a client Usually none; owner password at most
๐Ÿ“š Paid course material User password per buyer (accepting that it can be shared onward)
๐Ÿฅ Medical records User password, strong, out-of-band
๐Ÿ’พ Archiving something sensitive User password, stored in your password manager

๐Ÿ“– Four steps

1.  Open   โ†’  tooladda.online/pdf-password-protector.html
2.  Drop   โ†’  your PDF
3.  Set    โ†’  a USER password (strong, from a generator)
4.  Send   โ†’  the file one way, the password another way
Enter fullscreen mode Exit fullscreen mode

โ–ถ Protect now โ€” tooladda.online/pdf-password-protector.html

โš ๏ธ Warning

Save the password before you close the tab. There is no recovery, no reset link, and no support desk that can open the file for you โ€” that's what encryption means. Keep an unencrypted original somewhere safe, or store the password in a manager.


โ“ FAQ

Is it free?

Free, no signup, no watermark, no file-size limit beyond your device's memory.

Is my file or password uploaded?

Neither. Both stay in your browser โ€” the only safe arrangement for this particular operation.

User password or owner password?

User password if the content must be protected. An owner password only sets advisory restrictions and doesn't stop anyone reading the file.

Can "disable printing" be bypassed?

Yes. Permissions rely on the reader choosing to honour them, and many don't. Only the user password is enforced cryptographically.

I forgot the password. Can you recover it?

No. Nobody can. Keep an unencrypted original and store the password in a manager.

How do I remove protection later?

With the password remover โ€” using the correct password. It's a remover, not a cracker.


๐Ÿ”ฌ Under the hood

  • PDF encryption applied client-side in vanilla JavaScript; no upload endpoint exists.
  • Both user and owner passwords supported, with permission flags settable independently.
  • Nothing persisted: no history, no localStorage of passwords.
  • Works offline once loaded.

Originally published on ToolAdda, where Protect PDF runs free in your browser โ€” nothing is uploaded, nothing leaves your device.

Top comments (0)