A 35-page contract sent by email, a financial report shared over Slack, a client brief attached to a ticket: most PDFs travel across channels that offer no access control. Password protection adds a lock to the file itself, so only the person with the password can open it.
Here is how to do it in under a minute, without Adobe.
Two types of PDF passwords
The PDF specification defines two distinct password types, documented in the Adobe Acrobat security guide:
- Open password (user password): required to open the file. Without it, the document cannot be viewed at all.
- Permissions password (owner password): does not restrict opening the file, but controls what the reader can do: print, copy text, fill forms, annotate, or modify the document.
You can set one or both. Setting only a permissions password lets anyone open the file freely, but restricts editing or printing. Setting only an open password blocks all access without the password.
How PDF encryption works
Under the hood, PDF password protection uses symmetric-key encryption to scramble the document content. The password is used to derive a cryptographic key, which encrypts the file's streams and objects.
Encryption algorithms in the PDF spec
The PDF specification has used two encryption algorithms over the years, as documented in the qpdf encryption reference:
| Encryption | Key size | PDF version | Status |
|---|---|---|---|
| RC4 | 40-bit | PDF 1.1 | Obsolete |
| RC4 | 128-bit | PDF 1.4 | Weak, not recommended |
| AES | 128-bit | PDF 1.6 | Acceptable |
| AES | 256-bit | PDF 1.7 / PDF 2.0 | Recommended |
RC4 is now considered cryptographically broken. The qpdf documentation states directly: "the only way to securely encrypt a PDF file using the standard security handler (as of the last review of this chapter in 2022) is to use AES encryption." The IETF reached the same conclusion in RFC 7465 (2015), formally prohibiting RC4 in TLS due to "a variety of cryptographic weaknesses."
AES-256 was introduced in PDF 1.7 and is part of PDF 2.0 (ISO 32000-2:2020), the current international standard. Any modern tool defaults to AES-256 when available.
What happens when you set a password
- A random encryption key is generated
- That key is encrypted using a hash derived from your password
- The encrypted key is stored inside the PDF file
- When someone enters the password, the key is decrypted and the content unlocks
The password itself is never stored in the file.
Method 1: PDF4.dev (free, browser-based)
The fastest option: no software installation, no account, no file upload.
- Go to Protect PDF
- Drop your PDF onto the upload area
- Enter a password (12+ characters recommended)
- Click "Protect PDF" and download the result
Everything runs in your browser. The file never leaves your device.
Note on encryption strength: PDF4.dev's protect tool uses RC4-128 encryption via the
@pdfsmaller/pdf-encrypt-litelibrary, which is adequate for most everyday use cases (sharing contracts, blocking casual access). For documents with high-sensitivity data, use AES-256 via Adobe Acrobat or qpdf (see Method 3 below).
Method 2: Adobe Acrobat
If you have an Acrobat Pro subscription:
- Open the PDF in Adobe Acrobat
- Go to Tools → Protect → Protect using password
- Choose "Viewing" to set an open password, or "Editing" to set a permissions password
- Enter the password and click Apply
Acrobat also exposes granular permissions: restrict printing to low resolution, disable text selection, or prevent form filling. These are controlled by the owner password independently of the open password.
Method 3: qpdf (command line, AES-256)
qpdf is a free, open-source tool that produces AES-256 encrypted output. It is the most technically rigorous option.
# Set an open password (required to view the file)
qpdf --encrypt user-password owner-password 256 -- input.pdf protected.pdf
# Set only a permissions password (file opens freely, editing restricted)
qpdf --encrypt "" owner-password 256 \
--print=none \
--modify=none \
--extract=n \
-- input.pdf protected.pdfThe 256 argument specifies AES-256. As the qpdf encryption documentation explains, 256-bit key length always uses AES, and is the only fully secure option in the standard security handler.
Install on macOS:
brew install qpdfInstall on Ubuntu/Debian:
sudo apt install qpdfChoosing the right method
| Method | Encryption | Cost | File stays local | Best for |
|---|---|---|---|---|
| PDF4.dev | RC4-128 | Free | Yes | Quick protection, everyday documents |
| Adobe Acrobat | AES-256 | Paid | Yes | Granular permissions, enterprise use |
| qpdf | AES-256 | Free | Yes | Sensitive data, automation, scripting |
Password protecting a PDF on Mac, Windows, and mobile
Mac: Preview (built-in, no install needed)
macOS ships with Preview, which can encrypt PDFs natively:
- Open the PDF in Preview
- Go to File → Export as PDF
- Click Show Details
- Check Encrypt and enter a password
- Click Save
This uses AES encryption and requires no third-party software.
Windows: no built-in option
Windows has no native way to password protect a PDF. Microsoft Print to PDF creates an unencrypted copy, not a protected one. Your options: use PDF4.dev's browser tool (no install, works in Edge or Chrome), install Adobe Acrobat, or install qpdf via the official Windows release.
iPhone and Android
Neither iOS nor Android offers native PDF password protection. Options:
- Use PDF4.dev directly in your mobile browser (Safari or Chrome): the tool runs fully in-browser, identical to desktop.
- Use the Adobe Acrobat mobile app (requires an Adobe subscription for the encrypt feature).
What PDF password protection does not do
Printing to PDF is not encrypting
Choosing "Print to PDF" or "Save as PDF" creates a new unencrypted file with the same content. No password is set. This is one of the most common misconceptions about PDF security.
Screenshots and cameras bypass it
An open password prevents someone from opening the file digitally. It does not prevent someone from photographing a screen or taking a screenshot of an unlocked document. Password protection is a digital access control mechanism, not a content watermark.
PDF/A documents cannot be encrypted
If you use the PDF/A format for archival purposes, the standard explicitly forbids encryption. The Library of Congress format description for PDF/A-1 states: "PDF/A does not permit encryption." The reason is that archival formats must remain accessible indefinitely without relying on decryption capabilities that could become unavailable.
Weak passwords offer little protection
Password-cracking tools can test millions of candidates per second against a PDF. A password like "1234" or "company2026" offers minimal protection. Use at least 12 characters with uppercase, lowercase, numbers, and symbols, especially for sensitive documents.
Removing a password later
If you need to re-share a file without protection, or compress a protected PDF, you will need to remove the password first. Use Unlock PDF or, if you prefer the command line:
qpdf --decrypt --password=yourpassword input.pdf unlocked.pdfIf you want to compress a protected PDF, the correct order is: unlock, compress, then re-protect.
PDF4.dev generates PDFs from HTML templates with a single API call. Try the template editor to create invoices, certificates, or reports you can protect before delivery.
FAQ
Can I password protect a PDF for free?
Yes. PDF4.dev's Protect PDF tool is free and runs entirely in your browser. No account required, no watermarks, and your file is never uploaded to any server.
What is the difference between a user password and an owner password?
A user password (open password) is required to open the file at all. An owner password controls permissions: whether the file can be printed, copied, or edited. You can set one, both, or neither independently.
Can a password-protected PDF be cracked?
Yes, if the password is weak. Password-cracking tools can test millions of combinations per second. A strong password of 12+ characters with mixed case, numbers, and symbols makes brute-force attacks impractical.
Does password protection affect the PDF content?
No. Text, images, and layout remain identical. Protection only controls access: once unlocked, the document looks exactly as before.
Can I remove a password from a PDF I already protected?
Yes, as long as you know the password. Use the Unlock PDF tool or qpdf: qpdf --decrypt --password=yourpassword input.pdf output.pdf
Is printing to PDF the same as password protecting it?
No. Printing to PDF (or Save as PDF) creates a new unencrypted copy with no access control. It looks identical to the original but is completely unprotected.
Can I compress a password-protected PDF?
Not directly. Remove the password first, compress the file, then re-protect. PDF4.dev's Protect PDF and Unlock PDF tools handle both steps.
Which PDF encryption algorithm is most secure?
AES-256, introduced in PDF 1.7 and standardized in PDF 2.0 (ISO 32000-2:2020). The qpdf documentation explicitly states that AES is the only way to securely encrypt a PDF using the standard security handler.
Free tools mentioned:
Start generating PDFs
Build PDF templates with a visual editor. Render them via API from any language in ~300ms.