Home › PDF › Guides

🔬 In-depth guide

What a PDF Password Actually Protects (and What It Leaves in Plain Sight)

A PDF can carry two passwords that do very different jobs. Which one encrypts the content, which one is only a request, and what stays visible either way.

Two people can both say “I password-protected the PDF” and mean completely different things. One of them encrypted the file, so that without the password the pages are noise. The other set a flag asking viewers not to print it, and the file opens for anyone who double-clicks it.

The PDF specification has supported both for decades, under the same menu item in most software, which is why the confusion is so durable. This guide separates the two, explains what the encryption actually covers, and lists what a password leaves in plain sight no matter how strong it is.

Two passwords, two jobs

The standard security handler in a PDF defines two passwords.

The user password, better called the open password, is the one a reader must type before the document is decrypted. If it is set, the page content, the images and the text strings inside the file are encrypted, and a reader without the password gets nothing usable.

The owner password, better called the permissions password, controls a set of flags: may this document be printed, may text be copied, may it be modified or annotated. Supplying the owner password to a reader lifts those restrictions. Not supplying it leaves them in force, in the sense that a well-behaved viewer greys out the relevant menu items.

The important case is a file with an owner password and no user password. The specification handles it by encrypting the document with an empty open password. Every reader knows the empty password, so every reader decrypts the file silently, and the only thing the owner password protects is the permissions dictionary. The content is fully readable, by design, to anyone who opens the file. The flags are a request to the software, not a property of the data.

That is why “remove PDF restrictions” tools exist and why they are trivial: the content was never locked. It is also why our own password protect a PDF tool asks for a single password and sets it as the open password. Behind the scenes it generates a random owner password that is never shown, so there is exactly one secret to manage, and it is the one that does something.

What the encryption covers, and the ciphers behind it

PDF encryption is applied to strings and streams. Page content streams, embedded image streams, font programs and the text strings in the document information dictionary are all encrypted. Numbers, names, arrays and dictionaries are not. That distinction has real consequences, which the next section covers, but first the ciphers.

The standard security handler has gone through several revisions, and the cipher depends on which one a file uses:

A detail that surprised us while building the protect tool: the library it uses picks the cipher from the file’s declared version header and nothing else. Fed a %PDF-1.4 scan it would write RC4-128, and fed a %PDF-1.3 file it would write 40-bit RC4, while the page claimed AES throughout. The tool now raises the header to 1.7 before encrypting, so every file it produces uses AES-128, and a test asserts the emitted encryption dictionary rather than trusting the API. The general lesson is worth keeping: a “protected” PDF made by older software may be sitting on 40-bit RC4, and the only way to know is to look at the encryption dictionary, not at the padlock icon.

With AES in place, the cipher stops being the weak point and the password becomes it. A PDF does not store the password. It stores values derived from it that let a reader verify a guess, so an attacker with the file can try guesses offline at whatever speed their hardware allows. A short password protected by AES-128 is still a short password.

What stays visible with any password

Because encryption stops at strings and streams, the skeleton of the document is readable without a password:

None of that is a defect. It is the design, and it means a password answers the question “who can read this” and nothing else. If the author name, the creating application or the modification dates are themselves sensitive, the right move is to remove the PDF’s metadata first and lock the file second. Both the information dictionary and the XMP packet need clearing; many tools blank one and leave the other.

What a password does not do at all

Three things people reach for a password to achieve, and it does none of them.

It does not stop the recipient from sharing the content. Once someone has opened the file they have the plaintext. They can print it, screenshot it, or simply save an unencrypted copy. Our own unlock a PDF tool exists for exactly the legitimate version of this: you know the password, you are tired of typing it, you want the plain file back. It runs a real decrypt with the password you supply and reports a wrong one as “incorrect password” rather than trying to guess. But the point stands. Encryption controls entry, not what happens after.

It does not hide text under a black box. A rectangle drawn over a paragraph is a rectangle drawn over a paragraph; the text object is still in the content stream underneath it, selectable and extractable. Locking that file with a password protects the rectangle and the text equally, and the moment the file is opened both are available. Real redaction removes the content. Our redact a PDF tool does it by rasterising each marked page and rebuilding it as a flat image with the boxed pixels destroyed, which is the honest way to guarantee the words are gone, at the disclosed cost that the whole page loses its text layer.

It does not make a form un-editable. The “no modifying” permission flag is the owner-password request discussed above, and a viewer that ignores it can edit freely. If you need a filled form to stop being a form, flatten the PDF: the field widgets are converted into ordinary static page content, and there is nothing left to edit in the form sense. That is a change to the data rather than a request to the viewer, which is the whole difference.

A practical way to choose

Start from the question you are actually asking.

If the question is “who may open this”, set an open password, use a passphrase you would not mind defending, and send it through a different channel from the file. Check that the tool you use writes AES rather than RC4; if the software is old enough to offer 40-bit encryption as an option, it is old enough to distrust.

If the question is “may they print or copy this”, understand that the answer is advisory. Set the permission flags if a viewer’s greyed-out button is enough for your situation, and do not describe the result as secure.

If the question is “can I stop them from seeing this part”, a password is the wrong tool entirely. Redact the content, and remove the metadata, before anyone else gets a copy.

And if the question is “can I stop them from changing this”, flatten what can be flattened, and accept that a PDF you hand to someone is a PDF they can edit. Digital signatures, which are a separate mechanism from encryption, are the way to make changes detectable rather than impossible.

A PDF password is a good lock on the front door. It has never been a guard inside the house, and the specification never claimed it was.

The tools in this guide, in action

Screenshot of the Password Protect a PDF tool with sysfenix-report.pdf (3 KB) loaded, Allow printing once the file is unlocked set to on, Allow copying text/images once the file is unlocked set to on
Password Protect a PDF mid-process: sysfenix-report.pdf (3 KB) loaded, Allow printing once the file is unlocked set to on, Allow copying text/images once the file is unlocked set to on.
Screenshot of the Redact PDF tool with an empty dropzone waiting for a PDF to redact
Redact PDF mid-process: an empty dropzone waiting for a PDF to redact.

Frequently asked questions

If a PDF opens without asking for a password, can it still be "protected"?

Yes, and this is the most common kind of protected PDF. The file is encrypted with an empty open password, so every reader decrypts it silently, and an owner password sets permission flags that ask the viewer not to print, copy or edit. Those flags are a request to the software, not a barrier. Any tool that does not choose to honour them, and any tool that can re-save the file, ignores them completely. Treat an owner-only password as a courtesy notice.

Is a password-protected PDF safe to email?

If it was locked with a real open password and a decent passphrase, the content is encrypted with AES and is safe from anyone who intercepts the message. Two caveats matter. Do not send the password in the same email, because then the attachment and its key travel together. And remember that the recipient can remove the password and forward the plain file, because encryption only controls who can open the document, never what they do with it afterwards.

Does a password hide the document's metadata, page count or file size?

Only partly. PDF encryption applies to strings and streams, so page content, embedded images and the title and author strings are encrypted. The document's structure is not: the page count, the page sizes and the file size are readable from the plain dictionaries, and a file may declare that its XMP metadata is left unencrypted on purpose. If the metadata itself is the secret, strip it before locking the file rather than relying on the lock.

Can I recover a PDF password I have forgotten?

Not from the file. A PDF stores no copy of the password, only values derived from it that let a reader check a guess, so the only route is guessing. How long that takes depends on the password and the encryption revision, not on any tool. Our unlock tool needs the password you already know and reports a wrong one as exactly that; it does not guess, and nothing that runs in a browser tab is going to brute-force a good AES-128 passphrase.

Why can I not use an emoji or accented characters in a PDF password?

The older standard security revisions, everything up to AES-128, define the password as up to 32 bytes in a Latin-1 style encoding, so characters outside that set have no valid representation and different readers would encode them differently. AES-256 (revision 6) switched to UTF-8 and raised the limit to 127 bytes. Because our protect tool writes AES-128 files, it refuses characters it cannot encode rather than producing a file some readers cannot open.

Tools mentioned in this guide