Having to type in passwords repeatedly for multiple PDF files can really slow you down, especially if you’re using those files all the time.
If you’re at a point where password protection isn’t necessary anymore for your PDFs, you can actually get rid of those passwords using a command-line tool on both Windows and macOS. The best part is you can decrypt a whole bunch of PDFs at once, saving you a lot of hassle.
I’ll show you how to use QPDF, a command-line tool, to remove passwords from multiple PDF files in bulk. We’ll cover both Windows and Mac.
Things to Keep in Mind Before Removing Passwords
QPDF is a great tool, but it does have some limitations. Since it’s command-line based, there isn’t a user interface; you have to use commands. You can automate things with scripts, but all your PDFs have to use the same password for the batch process to work. If your PDFs have different passwords, you’ll have to decrypt them one by one.
Also, after you install QPDF, you need to set an environment variable to make sure your system recognizes the QPDF commands. It’s a little technical, but not that hard once you get the hang of it.
Method 1: Removing Passwords in Bulk on Windows
QPDF is a pretty reliable tool for decrypting PDFs. Since it’s command-line, you’ll install it, set up that environment variable I mentioned, and use Command Prompt or PowerShell to run the commands.
Here’s how to install QPDF, set the environment variable, and remove passwords from multiple PDFs on Windows.
Step 1: Install QPDF on Windows
First, go to github.com/qpdf in your browser. Download the installer for your system: qpdf-msvc64.exe
for 64-bit Windows or qpdf-msvc32.exe
for 32-bit Windows.
After it’s done downloading, open your downloads folder and double-click the .EXE
file to start the installation.
In the installer, click ‘Next’.
Agree to the license terms by clicking ‘Agree’.
Select your install location or keep the default. Click ‘Next’.
Click ‘Install’.
Once it’s done, click ‘Finish’.
Step 2: Set the Environment Variable
Okay, now we need to set the environment variable so your system knows where QPDF is located.
Go to the QPDF installation folder. If you didn’t change it, it’s probably in ‘Program Files’.
Open the ‘Program Files’ folder.
Look for the ‘QPDF’ folder and open it.
Now, open the ‘Bin’ folder inside the QPDF folder.
Click in the address bar, highlight the path, and press Ctrl
+ C
to copy it.
Go to the Start Menu and click on the ‘Settings’ icon.
Make sure ‘System’ is selected on the left.
Scroll down and click on ‘About’.
Click on ‘Advanced system settings’.
In the System Properties window, click on ‘Environment Variables’ under the ‘Advanced’ tab.
Under ‘System variables’, find and select ‘Path’, then click ‘Edit’.
Click ‘New’ in the Environment Variables window.
Paste the path you copied earlier and click ‘OK’ to save.
To make sure the variable is set, open the Start Menu, type Terminal
, and select ‘Run as administrator’ for Windows Terminal.
Click ‘Yes’ if prompted by UAC.
Type this command and press Enter
:
qpdf --version
It should display the QPDF version, which confirms everything is set up.
Step 3: Remove Passwords from Multiple PDF Files
Now, let’s make a PowerShell script to remove those passwords.
Make sure all the PDFs you want to decrypt are in the same folder.
Open Notepad.
Paste this script into Notepad:
$PASSWORD = "<yourpasswordhere>"
Get-ChildItem -Filter *.pdf | ForEach-Object {
$decryptedFileName = "decrypted-$($_.Name)"
& qpdf --password=$PASSWORD --decrypt $_.Name $decryptedFileName
}
Note: Change <yourpasswordhere>
to your actual PDF password.
Click ‘File’ then ‘Save As’.
Go to the folder with your PDFs. Save the file as something like decrypt.ps1
.
Go to the folder with your PDFs and the script file. Copy the folder path.
Open an elevated Terminal by searching for it in the Start Menu, right-clicking on it, and selecting ‘Run as administrator’.
In the Terminal, go to the directory with your PDFs and the script using the cd
command:
cd <copied path here>
Note: Replace <copied path here>
with the actual path.
Run the script:
.\decrypt.ps1
Note: If you named the script something different, change decrypt.ps1
to your script file name.
You might not see any confirmation in the terminal. Check the folder. You’ll see decrypted copies of your PDFs with ‘decrypted-’ added to the front of their file names.
You can use or share these decrypted files now.
Method 2: Removing Passwords in Bulk on Mac
Mac users can also use QPDF for batch PDF decryption. The process is similar, and QPDF is still a great option for this. Just like with Windows, all the PDFs need the same password for this to work.
Step 1: Install QPDF on Mac
You’ll install QPDF through the Terminal using Homebrew, so make sure you have Homebrew and Xcode Command Line Tools installed.
Open Finder, go to ‘Applications’, and then ‘Utilities’.
Open ‘Terminal’. Or, press Cmd
+ Space
, type Terminal
, and press Enter
.
To install Homebrew (if you don’t have it yet), run this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter your password when asked (you won’t see characters as you type it). Press Enter
to continue.
Press Enter
again to confirm the installation.
After Homebrew installs, run these to add Homebrew to your path:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"')
eval "$(/opt/homebrew/bin/brew shellenv)"
Check your Homebrew install by typing:
brew --version
You should see the version of Homebrew.
Now, install QPDF:
brew install qpdf
Verify your QPDF installation:
qpdf --version
You’ll see the QPDF version if it worked.
Step 2: Create the Bash Script
Now, let’s write a bash script to remove those passwords.
Use any text editor. I’m using TextEdit, which comes with macOS. Open TextEdit from ‘Applications’ or Spotlight.
Type or paste this into TextEdit:
#!/bin/bash
PASSWORD="yourpasswordhere"
for file in *.pdf; do
qpdf --password=$PASSWORD --decrypt "$file" "decrypted-$file"
done
Note: Change "yourpasswordhere"
to your actual password.
If needed, select ‘Make Plain Text’ from the ‘Format’ menu to make sure it’s plain text.
Click ‘Save’ from the ‘File’ menu.
Name it something like decrypt.sh
and save it to the same folder as your PDFs. Uncheck the ‘If no extension is provided, use ".txt"’ option if it’s selected.
Step 3: Run the Bash Script
Time to run the script to remove the passwords.
Open Terminal and go to your PDF folder:
cd /path/to/your/directory
Note: Replace /path/to/your/directory
with the actual path. You can copy it from Finder with Cmd
+ Option
+ C
.
Type pwd
to make sure you’re in the right directory.
Make the script executable:
chmod +x decrypt.sh
Run the script:
./decrypt.sh
This will decrypt all PDFs in that folder and save the decrypted versions with decrypted-
in the front of their file names.
By following these steps, you can quickly remove passwords from multiple PDF files on both Windows and Mac.