🔒

Protect PDF

Password protect a PDF: encrypt it with AES-256 in your browser, so it opens only with the password.

Your files stay on this device. Nothing is uploaded. How to check

Advertisement

How to use Protect PDF

1. Upload the PDF you want to protect (up to 150 MB).
2. Type a password of at least 4 characters and confirm it. Untick "Print the document" or "Copy text and images" if readers should not be allowed to.
3. Click Encrypt & Download PDF. The file is saved as protected_yourfile.pdf and asks for the password when opened.

Key features of Protect PDF

🔒 AES-256 encryption

Every string and stream in the file is encrypted with AES-256 (PDF security handler revision 6) using your browser's WebCrypto. A reader cannot show the content without the password.

đŸ–Ĩī¸ Encrypted on your device

The password and the file stay in the page. Nothing is sent to a server, so there is no copy anywhere that could be recovered.

đŸ–¨ī¸ Print and copy flags

Printing and text copying can be switched off. These are permission flags that readers are asked to honour. When a box is unticked, the owner password is a random value that is never shown or stored, so the password you type does not lift the limits; Unlock PDF can still remove them with that password.

About Protect PDF

Protect PDF generates a random 256-bit file key, encrypts every string and stream in the document with AES-256, and stores the key wrapped by a SHA-2 based hash of your password, as described by the standard security handler (revision 6) in the PDF specification. The output is an ordinary encrypted PDF: any reader that supports AES-256 prompts for the password before showing anything.

Use it before emailing a payslip, contract or medical record, or when a file will sit on a shared drive. The password is never sent or stored anywhere, which also means it cannot be recovered: if you lose it, the document cannot be opened. Revision 6 encryption is read by Adobe Acrobat X and later and by other readers that support PDF 2.0 encryption; older readers cannot open the file.

When to use Protect PDF

A letting agent or bank asks for a scan of your passport or a recent statement by email. Encrypt the file here, send it, and pass the password on by a different route such as a phone call or a text message. Anyone who later reads that mailbox has the file but not the means to open it.

A payslip, a reference or a signed offer letter goes to one person and should be readable by that person only. Protect it with a password you agree with them, and untick "Copy text and images" if you would rather it was not pasted into other documents, remembering that a reader is only asked to honour that flag.

A folder of contracts sits on a shared drive or in a cloud backup. Encrypting each file before it goes there means the stored bytes are unreadable without the password, whatever happens to the storage account, and each file still opens in an ordinary reader when you need it.

A password is the wrong tool for some jobs. If the recipient may read most of a document but not certain names or numbers, use Redact PDF, which deletes those words from the file. If you want copies marked as drafts or as belonging to one recipient, use Watermark PDF. To take a password off again, use Unlock PDF.

Tips and troubleshooting

  • Three messages can appear under the form: "Enter a password to protect the document." when the first box is empty, "The two passwords do not match." when the confirmation differs, and "Use a password of at least 4 characters." Pressing Enter in the confirmation box submits the form.
  • Passwords are case-sensitive and may contain spaces and characters from any language. Following the PDF specification, only the first 127 bytes of the password (in UTF-8) are used.
  • "Failed to protect PDF" with a message that the input is encrypted means the file already has a password. This tool does not change an existing password: remove it with Unlock PDF, then encrypt the unlocked copy with the new one.
  • "This browser does not expose WebCrypto" appears when the page is loaded over plain http from a machine other than your own, because browsers only offer WebCrypto on https and localhost. Open the site over https.
  • The protected file is usually a little larger than the original. Every string and stream gains a 16 byte initialisation vector and padding, and the file is written without object streams so that each object can be encrypted on its own.
  • Preview Document opens the result in your browser's own PDF viewer, which asks for the password before showing a page, so the preview doubles as a check that the protection took.
  • The output is named protected_ followed by the original filename and the original file is left as it was. The tool does not store the password anywhere, so write it down before you close the tab.
  • The guide how to password protect a PDF explains what the password covers and how to choose one that holds.

How Protect PDF works in your browser

The file is read into memory and parsed by pdf-lib. The site's own pdf-crypto module then draws 32 random bytes from the browser's random number generator as the file key. Your password is hashed with the revision 6 algorithm of the PDF specification, a loop of SHA-256, SHA-384 and SHA-512 rounds with AES mixing, and the file key is wrapped under that hash to produce the /U and /UE entries. The owner entries, /O and /OE, are made the same way from your password, or from a random one when printing or copying is switched off; a separate AES block, /Perms, records the print and copy flags. All of the hashing and AES work is done by the browser's WebCrypto API, not by JavaScript arithmetic.

pdf-crypto then walks every object in the document and encrypts each string and each stream with AES-256 in CBC mode under the file key, with a fresh random initialisation vector per object; the document's metadata stream is encrypted too. The /Encrypt dictionary is added last so that it is never itself encrypted, and pdf-lib serialises the result without object streams. The bytes become a Blob behind the Download button. The password and the file exist only as variables in the page: no request carries either, and reloading the page discards both.

Frequently asked questions

Is this real encryption or just a restriction flag?

It is encryption. The file's contents are encrypted with AES-256 and cannot be read without the password. Permission-only protection, where a reader is merely asked not to allow printing or copying, is different; here the bytes themselves are unreadable.

Can you recover my password if I forget it?

No. The password never leaves your browser and is not stored anywhere, so there is nothing to recover it from. Keep a copy of it somewhere safe before you share the file.

Which PDF readers can open the protected file?

Any reader that supports AES-256 (revision 6) encryption, which includes Adobe Acrobat X and later and other readers with PDF 2.0 encryption support. Older readers cannot open it.

Can I set a separate owner password?

No. With both boxes ticked, the password you type is also the owner password. With either box unticked, the owner password is a random value that is never shown or stored, so the print and copy limits apply to everyone who opens the file with your password. Readers are only asked to honour those limits, and Unlock PDF can remove them with your password.

Does the file get bigger?

Usually a little. Each string and stream gains a 16 byte initialisation vector and padding, and the document is written without object streams so that every object can be encrypted individually. Pages, images and fonts are otherwise unchanged.

Does it keep form fields, bookmarks and links?

Yes. Encryption changes how strings and streams are stored, not the structure of the document, so fields, bookmarks, links and annotations are all present once the file is opened with the password. Field appearances are saved as they were, not regenerated.

Last reviewed