Keeping sensitive data password protected is a must in today's digital age. However, entering the password to a PDF that you open several times in a day might become exhausting and annoying real soon.

Thankfully, if you are confident that you do not require passwords anymore on PDFs, you can easily remove them using a command line tool on your Windows or macOS computer.

The best part? You can remove passwords from multiple files in a single go.

Limitations to Removing Passwords from PDF Files

There are certain limitations when using a command-line tool. First and foremost is the absence of GUI. All the actions need to be performed using Powershell commands. You can write a script to automate the process and run it every time you want to remove the password from multiple PDFs, though.

However, all the PDFs have to have the same password for the script to work. If you have multiple PDFs with different passwords, you will have to do the process manually.

Also, after installing the command-line tool, you will need to set the environment variable on your computer so it can understand the commands specific to the tool. However, this is not a limitation but might seem a bit technical to some users.

Remove Password from Multiple PDF Files on Windows

Though there are many third-party software available in the market that can decrypt the files for you, however, we found QPDF to be the most reliable one.

Since QPDF is a command line tool, after the installation, you will need to set an environment variable and then type in commands using Terminal to perform desired actions on a PDF.

It might sound too technical at first read; however, follow the instruction below, and you will be done before you know it.

1. Install QPDF on your Windows Device

First, head to github.com/qpdf using your preferred browser. Then, click on the qpdf-msvc64.exe or qpdf-msvc32.exe depending if your version of Windows is 64-bit or 32-bit.

Next, head to the default downloads directory and double-click on the .EXE file to run the installer.

On the installer window, click on the 'Next' button to proceed.

After that, click 'Agree' to continue.

On the next screen, you can choose the installation directory. Click 'Browse' to open a File Explorer window and change the directory. Once done, click 'Next' to continue.

After that, click 'Install' to commence the installation.

Once the installation has been completed, click 'Finish' to close the window.

2. Set Environment Variable

Once the installation is complete, let's move on to the next step. Without setting an environment variable, you won't be able to use commands that are specific to QPDF.

First, head to the installation directory of QPDF. If you did not customize it during the installation, it would be the Windows installer drive on your computer.

After that, double-click on the 'Program Files' folder.

Next, locate the 'QPDF' folder and double-click on it.

Afterward, double-click on the 'Bin' folder.

Now, click on the address and press Ctrl+C on your keyboard to copy the path. Keep it handy as you will need it in further steps.

Now, head to the Start Menu and click the 'Settings' icon.

After that, ensure you have selected the 'System' tab from the left sidebar.

Next, from the right section, locate and click on the 'About' tile to proceed.

On the next screen, click the 'Advanced system settings' option. This will bring an overlay window to your screen.

After that, make sure you have selected the 'Advanced' tab. Then, click on the 'Environment Variables' button to proceed. This will open a separate window to your screen.

From the separately opened window, locate the 'Path' variable and click on it to select. Then, click 'Edit'. This will open a new window on your screen.

On the 'Environment variable' window, click on 'New' to proceed.

After that, paste the 'Bin' folder path you earlier copied in the field given and click 'OK' to save. That's it environment variable is now set.

To check it, head to the Start Menu and type Terminal to perform a search. Then, from the search results, right-click on the 'Terminal' tile and select the 'Run as administrator' option.

Now, a User Account Control (UAC) window will appear on your screen. If you are not logged in with an admin account, enter the credentials for one. Otherwise, click 'Yes' to proceed.

After that, type or copy+paste the below-mentioned command and hit Enter to execute.

qpdf --version

The command should return the currently installed version of QPDF on your computer.

3. Remove Passwords From Multiple PDF Files in Single Go

To remove passwords from PDFs in bulk, we will be using a Powershell script file.

The very first step is to make sure all the PDFs you want to remove the password from are located under the same directory as shown in the screenshot.

Now, head to the Start Menu and type Notepad to perform a search. Then, from the search results, click on the 'Notepad' tile to proceed.

On the Notepad file, type or copy+paste the below-mentioned script.

Note: Replace the <yourpasswordhere> placeholder with the actual password for the PDF files.
$PASSWORD = "<yourpasswordhere>"
Get-ChildItem -Filter *.pdf | ForEach-Object {
    $decryptedFileName = "decrypted-$($_.Name)"
    & qpdf --password=$PASSWORD --decrypt $_.Name $decryptedFileName
}
Notice the actual password replaces the placeholder.

Then, click the 'File' tab and select the 'Save As' option.

From the 'Save As' window, navigate to the directory your PDF files are located. Then, make sure you save the file with .ps1 extension.

Once the file is saved, head to the directory comprising all the PDFs and the Powershell script. Then, click on the 'Address bar' and copy the path. Keep it handy as it will be required in forthcoming steps.

Head to the Start Menu and open an elevated Terminal window, as shown earlier in this guide.

After that, type or copy+paste the below-mentioned command to set the directory.

Note: Replace the <copied path here> placeholder with the actual address path that you copied in the earlier steps.
cd <copied path here>

After that, type or copy+paste the below-mentioned command and hit `Enter' to execute.

.\<script file name>.ps1

Note: Replace the <script file name> with the actual file name you provided in the earlier steps.

Though you will receive no confirmation on the Powershell screen, once the command has been successfully executed, visit the folder comprising all the PDF files, and you shall see the decrypted versions of them with a decrypted prefix to them.

That's it. You can now share the decrypted files and/or use them as you wish.

Remove Password from Multiple PDF Files on Mac

If you're a Mac user, you can still use QPDF to remove passwords from multiple PDF files, as it is still the most convenient method. However, do remember that the same condition applies here. It can only remove the password from multiple files in one go if the files have the same password. Moreover, it can only remove passwords from PDF files that are password protected and not fully encrypted. Let's get on with it.

1. Install Qpdf

The first step you would need to perform is to install QPDF on your Mac. You can install QPDF on your Mac using the terminal. But you'll first need Homebrew and XCode command line tools installed on your Mac for this.

From the Finder, go to 'Applications' from the left sidebar.

Then, navigate to 'Utilities'.

From the Utilities folder, open 'Terminal'. You can also use the Cmd + Space keyboard shortcut to open Spotlight Search and then type Terminal to open it.

To install Homebrew (skip if Homebrew is already installed), run the following code in the Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

You'll need to enter your user password to proceed. Type the password and press 'Enter'. You won't see any characters being typed on the terminal as you type the password. Still, type the password normally.

Then, it will list the scripts it will install and the directories that will be created. Press 'Enter' to proceed.

Homebrew will be installed. Next, you'll need to run the following two commands one by one to add Homebrew to your path:

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"')
eval "$(/opt/homebrew/bin/brew shellenv)"

The Homebrew setup is complete. You can verify it using the following command:

brew --version

It should return the Homebrew version like this: Homebrew 4.1.1

Now, to install QPDF, you need to run the following command in the Terminal:

brew install qpdf

To verify if QPDF was successfully installed, run the following command:

qpdf --version

If QPDF is installed properly, it should return an output like qpdf version 11.5.0 where the version number might be different on your end.

There are also other ways to install QPDF such as compiling it from the source. But I found this to be the quickest and most convenient.

2. Create the Bash Script

The next step involves creating the Bash script that we'll run to remove the passwords from the PDF files using QPDF.

You can use any text editor or code editor to write the bash script. For the sake of this guide, we'll be using the TextEdit text editor distributed inherently with macOS. Go to Applications and double-click on the 'TextEdit' editor or open it using spotlight.

Then, write or copy-paste the following script into the editor:

#!/bin/bash
PASSWORD="yourpasswordhere"
for file in *.pdf; do
  qpdf --password=$PASSWORD --decrypt "$file" "decrypted-$file"
done
Note: Replace "yourpasswordhere" with the actual password of your PDF files.
Note that we've replaced the string yourpasswordhere with the actual password above.

Save this file with a .sh extension. However, to save the file with a .sh extension, you need to make sure that TextEdit is creating a plain text file and not a rich text file. Go to the 'Format' menu option from the menu bar and select 'Make Plain Text' from the menu. If you don't see the option but instead see Make Rich Text, you don't need to do anything.

Now, go to the 'File' menu option and select 'Save' from the menu bar.

Enter a name for the file with the .sh extension in the 'Save as' field. For example, you can name it decrypt.sh

Choose the location where you want to save the bash file. Save the bash file in the same folder where your PDFs are stored. Then, uncheck the 'If no extension is provided, use '.txt'' checkbox if it's checked. Click the 'Save' button.

3. Run the Bash Script

Now, the only thing left to do is to run the bash script.

First, navigate to the folder/ directory where your PDF files and the bash file are stored. To change the directory, use the cd command as follows:

cd /Users/sakshigarg/Downloads/PDFs
Note: Replace the path to the directory above with your actual path. To get the path of the folder, go to the folder from the Finder, and use the Cmd + Option + C keyboard shortcut to copy the path.

You can check that you've successfully navigated to the directory by running the pwd command in the Terminal. It should return the same address as you entered.

Now, change the permission of the bash script and make it executable so that it can be run as a program. To do so, enter the following command in the Terminal:

chmod +x decrypt.sh

Finally, run the script using the following code:

./decrypt.sh

This script will create a decrypted copy of each PDF file in the current directory, prefixing the name with "decrypted-".


There you have it. No matter which operating system you're on, removing passwords from multiple PDF files won't be a headache any longer.