Forum Discussion
How to delete password from pdf on Windows as it is password protected?
I've got a password-protected PDF that I need to unlock so I can edit it, but every online tool I try either wants me to upload the file (which feels sketchy) or charges money after the first page—does anyone know a legit free way to do this locally on Windows without installing sketchy software? I just want to strip it off so the file opens freely, and I'm totally lost on how to delete password from PDF without paying for Adobe Acrobat Pro.
So I'd love a simple, free method that actually works offline—maybe a built-in Windows print-to-PDF trick or a trustworthy open-source tool that shows me how to delete password from PDF without compromising the file's content or messing up the formatting.
8 Replies
- ZackZhangIron Contributor
If you attempt to delete password from PDF (a document with more than 10 pages,) the code will likely not complete the task as expected.
- ZannnsbeIron Contributor
For example, one popular version, pdf-password-remover by ugurkiymetli, can batch-process entire folders and even try a list of common passwords if you don't specify one. Since it's just a Python script, it's exactly the kind of obscure, free method you're looking for to avoid paid third-party software.
To show you exactly how to delete password from PDF using this kind of tool, let's break down the steps you'd generally follow:
- If you don't have it already, download and install Python 3.7 or newer from the official website.
- Download the pdf_password_remover.py file from its GitHub page. You can usually do this by clicking the green "Code" button and selecting "Download ZIP".
- Open your command prompt, navigate to the folder with the script, and run pip install -r requirements.txt to install the required libraries.
- To process a single PDF file, you'd use a command like python pdf_password_remover.py "C:\path\to\your\folder" and enter the password when prompted. If you know the password, you can use -p "mypassword" right in the command.
- The script will create a new folder (usually called "unprotected") and save a password-free copy of your PDF there.
It's a pretty straightforward process to learn how to delete password from PDF using this free tool. Just make sure you only use it on files you own or have permission to modify. Since this is a manual process, be sure to check the specific instructions on the GitHub page for the version you download, as the details can vary a bit.
- ThatcherwIron Contributor
PDFtk is an open-source command-line PDF tool that delivers a fast offline scriptable terminal solution for how to delete password from pdf via a single simple line command to quickly generate unlocked PDF copies without uploading files online.
How to Remove Password from PDF
1. Download and install the software toolkit from the official website, and configure the system environment variables so that the software commands can be recognized.
2. Move the password-protected PDF file to a separate, easily accessible folder.
3. Open the Command Prompt and change the working directory to the folder containing the target PDF file.
4. Enter the following decryption command, replacing YOUR_PASSWORD with the actual open password for the PDF file:
pdftk input.pdf input_pw YOUR_PASSWORD output output.pdf
5. Press Enter to execute the command. An unencrypted output.pdf file will be generated in the same folder.
Disadvantages
- Operates entirely via the command line; there is no graphical user interface.
- Requires manual installation and configuration of environment variable paths before use.
- Cannot recover or bypass unknown PDF open passwords; the correct password must be entered.
- No built-in PDF preview feature; file contents cannot be viewed before decryption.
This lightweight command-line tool runs quickly and can be used in conjunction with batch scripts, effectively streamlining repetitive tasks when you need to remove passwords from PDF files. Its main drawback is the lack of a graphical user interface, which can present a learning curve for users unfamiliar with terminal operations.
Note
- Before executing the command, carefully check the spelling of the PDF filename and password to prevent execution failures.
- If you plan to write a batch decryption script, store PDF files with different passwords in separate folders.
- During the decryption process, please close other software that consumes a large amount of system resources to avoid slowing down the processing of large PDF files.
- BrantGarciaIron Contributor
This is a great script-based solution to easily delete password from pdf without relying on paid PDF unlocking desktop software. It essentially lets you write customized Python code to decrypt encrypted PDF files offline on your local machine, allowing you to automate single or bulk decryption tasks and export brand-new password-free PDF documents.
Usage Guide: Install the Python runtime environment on your device and run pip install PyPDF2 in Command Prompt to complete library installation, create a new .py file and paste the full decryption code below, replace "input.pdf" with the path of your encrypted file and fill in the correct PDF opening password at "YOUR_PASSWORD", adjust the output file name as needed, then execute the Python script to generate an unlocked PDF.
from PyPDF2 import PdfReader, PdfWriter reader = PdfReader("input.pdf") reader.decrypt("YOUR_PASSWORD") writer = PdfWriter() for page in reader.pages: writer.add_page(page) with open("output.pdf", "wb") as f: writer.write(f)This method runs entirely offline without uploading any document data to cloud servers and swiftly helps you reliably delete password from pdf, effectively handling automated batch PDF decryption workflows for repeated work demands.
It is particularly useful for advanced users with basic coding skills, regular bulk PDF decryption work, or embedding PDF password removal logic into local automatic processing scripts.
- ArthurDavisIron Contributor
Windows PowerShell is a native Windows scripting shell that uses local Adobe Reader COM components to offer a built-in automated script way to delete password from pdf without manual graphical unlocking for single encrypted PDF files.
How to Remove Password from PDF
Step 1: Right-click the Start menu and run Windows PowerShell as an administrator.
Step 2: Copy and paste the following script block into the PowerShell window:
$pdf = New-Object -ComObject AcroExch.PDDoc
$pdf.Open(“C:\path\to\input.pdf”)
$pdf.Save(1, “C:\path\to\output.pdf”)
$pdf.Close()
Step 3: Replace the input and output file paths within the quotes with the actual locations where your PDF files are stored.
Step 4: Press Enter to run the script; the tool will generate a new, unencrypted PDF file.
Finally, navigate to the specified output path to access the password-free PDF document.
This is because all modern Windows systems come with PowerShell preinstalled. However, the script relies on locally installed Adobe software; if the required COM components are missing, the script will not run.
Pros
- All decryption operations are performed locally and offline; no PDF data is uploaded to the cloud.
- The script is concise and compact, requires minimal configuration, and is suitable for unlocking a single PDF file.
- After removing password protection, the original PDF’s layout and formatting are preserved.
Cons
- By default, it supports only single-file processing; batch decryption requires additional coding.
- PowerShell must be run as an administrator to avoid component access errors.
- It cannot bypass unknown PDF passwords; you must know the correct open password in advance.
- SamkkinlonIron Contributor
For a completely code-based, free method that many might not know about, Free Spire.PDF for Python is a great library. It's a "completely free" way to delete password from PDF by writing just a few lines of Python code.
How to Use Free Spire.PDF:
1. Install the Library: Open your command prompt or terminal and run pip install Spire.PDF.Free.
2. Write the Script: Create a new Python file (e.g., unlock.py) and write this script, replacing the file paths and password with your own:
python
from spire.pdf import *
# Create a PdfDocument object
doc = PdfDocument()
# Load the password-protected PDF file with its password
doc.LoadFromFile("C:/input/your_protected_file.pdf", "your_password")
# Set the password to empty strings to remove protection
doc.Security.Encrypt(str(), str(), PdfPermissionsFlags.Default, PdfEncryptionKeySize.Key128Bit, "permissionpassword")
# Save the unsecured PDF file
doc.SaveToFile("C:/output/unlocked_file.pdf", FileFormat.PDF)
doc.Close()
3. Run the Script: Execute the script, and it will create a new, password-free PDF in the output location you specified.
If your PDF is 10 pages or less, this is a very effective, free, and offline method to delete password from PDF file. You just need to know the password and be ready to write or copy a few lines of Python code.
- DassIron Contributor
pdfdecrypt is a decent, totally free command-line tool if you're comfortable with a bit of typing. It's basically a straightforward way to how to delete password from PDF files when you already know the password.
How It Works: you run it, it asks for the PDF's password, and it spits out a new copy without the password protection.
1. Installation: You'll need Python installed on your PC. Once you have that, you just open your command prompt and type:
pip install pdfdecrypt
2. Running the Tool: After it's installed, navigate to the folder containing your encrypted PDF using the cd command. Then, just type:
pdfdecrypt your_ file. pdf
3. Enter the Password: The program will prompt you for the password. Type it in, and it will generate a new, unlocked version of your PDF in the same folder.
The Good
- It's Free and Open-Source: Uses the GNU Affero General Public License, so it's completely free to use.
- Lightweight: It's a simple Python script that gets the job done without any bloat.
- Preserves Content: It removes the password without changing the file's internal structure, so your content stays intact.
You already know the password and just want a free way to how to delete password from PDF without any shady third-party software. If you're looking for a more user-friendly, graphical tool, there are plenty of other free options out there, but if you're fine with the command line, pdfdecrypt is a reliable and free choice.
- DashielQuinnIron Contributor
Mozilla Firefox is a free built-in browser PDF viewer, but it only supports how to delete password from pdf for PDFs that allow printing, as it relies on the print-to-PDF saving feature to strip encryption.
It allows you to generate an unlocked PDF without extra PDF tools, but using this trick requires you to know the PDF opening password.
First, drag your password-protected PDF file into Firefox to open it. Enter the correct password to access full PDF content, then press Ctrl + P to bring up the print panel.
In the print destination dropdown, select "Save as PDF", set your storage path and new file name, then click Save to export the decrypted file.
Once saving finishes, you will get a new password-free PDF document on your local disk.
This method cannot how to delete password from pdf if the source PDF disables printing permissions, so it is only suitable for un-restricted printable encrypted PDF files.
If you don’t want to install dedicated PDF decryption software, you can try this method. It may lose bookmarks and complex formatting, so you should check the output PDF content carefully.