By Tim King · Updated
Password Protect PDF
Encrypt a PDF With AES-256 and Set Print, Copy and Edit Permissions
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Password Protect PDF works
Password protect PDF files before you email or upload them. Drop the file in, choose an open password and, if you like, limit printing, copying and editing. The file is encrypted with AES-256 in your browser, so neither the PDF nor the password is uploaded.
Payslips, contracts, medical letters and invoices with bank details travel by email all the time, and email is not a private channel. Messages sit in several mailboxes, get forwarded and are synced to phones. A password on the attachment means that anyone who gets hold of the file still cannot read it, and you can send the password separately by text or phone.
How to password protect PDF files
- Drop the PDF into the box.
- Type an open password. Anyone opening the file will need it.
- Optionally set an owner password and choose what readers may do.
- Run the tool and download the copy ending in
-protected.pdf.
Open the downloaded file once to check that the password works before you send it.
What each setting does
| Setting | Effect |
|---|---|
| Open password | Required to open the file at all; the content key is derived from it |
| Owner password | Lets its holder lift the permissions; random if left empty |
| Allow everything | No restrictions once the file is open |
| Allow printing only | Print at full quality; no copying, editing or form filling |
| Block printing, copying and editing | View only, plus screen-reader access |
The open password is real protection: without it the content is unreadable. Permissions are different. They are a flag that well-behaved readers such as Acrobat, Preview and browser viewers respect, but any tool that has the open password can ignore them. Treat them as a polite request that stops casual copying, not as security.
How it works
The tool opens the file with pdf-lib, an open-source PDF library, and encrypts it using the standard security handler from PDF 2.0 (revision 6), which every current reader supports.
A random 256-bit key is generated with your browser's secure random number generator. Every string and every stream in the document is encrypted with that key using AES in CBC mode, each with its own random starting block. The key itself is then stored twice in the file, wrapped once with a hash of the open password and once with a hash of the owner password. Each hash runs at least 64 rounds of AES and SHA-256, SHA-384 or SHA-512 over the password and a random salt, which makes guessing slow. The permissions are written into an encrypted block too, so they cannot be changed without the key.
Choosing a good password
Length beats complexity. Four or five random words, such as copper lantern yellow tide, are
far harder to guess than a short mix of symbols and easier to read out over the phone.
Never reuse an account password. If you send the password alongside the file, assume both may be seen together one day.
Send the password another way. Put the file in the email and the password in a text message or a call. Sending both in the same thread defeats the point.
Tips and pitfalls
There is no recovery. If you forget the open password, nobody can open the file, including this site. Keep the original unprotected copy somewhere safe.
Set an owner password if you restrict permissions. When the owner box is empty a random owner password is used, so the restrictions can only be lifted by unlocking with the open password.
Already-protected files are refused. A file that already has a password or restrictions has to be unlocked first, then protected again with the new settings.
Metadata is encrypted too. The title, author and other document details are hidden until the file is opened. Use the PDF Metadata Remover first if you also want them gone from the opened copy.
Signed PDFs lose their signature. Encrypting rewrites every object, so a digital signature on the original no longer matches. Protect the file before it is signed, not after.
Reading the result
Encryption confirms AES 256-bit. Permissions repeats the option you chose. A note appears if you restricted permissions without setting an owner password, as a reminder to keep the original.
FAQ
How secure is a password protected PDF?
With AES-256 and a long password, the content cannot be read without the password. The weak point is the password itself, so use several random words and never send it in the same email as the file.
Will the protected PDF open on phones and in browsers?
Yes. AES-256 encryption is supported by Acrobat Reader, Apple Preview, Chrome, Edge, Firefox and the built-in viewers on iPhone and Android, and each one asks for the password when the file opens.
What happens if I forget the password?
The file cannot be opened. The key is derived from the password and is not stored anywhere else, so no tool can recover it. Keep the unprotected original in a safe place until the file is received.
Is my PDF or password uploaded anywhere?
No. The encryption runs in JavaScript inside your browser tab using its built-in Web Crypto functions. Neither the file nor the password is sent to a server at any point in the process.
See also: all PDF tools, Images, Audio, Video & Screen, SVG, Simulations & Screensavers, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.
Related tools
Unlock PDF
Remove the password and restrictions from a PDF you can open.
PDF Watermark
Stamp text across every page of a PDF, in-browser.
PDF Metadata Remover
Strip author, dates and hidden XMP metadata from a PDF privately.
Flatten PDF
Lock filled form fields and comments into the page.
PDF Merger
Combine PDFs into one file in your browser: nothing uploaded, pages in any order.