pdfcosmos

Remove JavaScript from PDF

Strip embedded scripts from your PDFs in one click for a safer document.

Free, fast, and privacy-first.

Remove JavaScript from your PDFs

or drag & drop files here

PDF files onlyup to 30 filesup to 100 MB each300 MB total

Remove JavaScript from a PDF — strip embedded scripts for safety

PDFs can carry JavaScript — document-level scripts, a script that runs the moment the file opens (OpenAction), page and document triggers on open/close/print/save, scripts attached to annotations, and a form's calculation, format, and validation logic. Remove JavaScript strips all of it. Scripts have legitimate uses in interactive forms, but they're also a common way malware hides in a document, so removing them makes a PDF safer to open and share.

Each script object and its source are deleted from the file, not just unlinked, so the code doesn't linger in the bytes. The pages, text, and images are untouched and the document still reads normally — only interactive behaviour that depended on a script (like a form field that auto-calculates a total) stops working. Clickable links are kept, because they use link actions rather than JavaScript. Clean one PDF or up to 30 at once (a ZIP for several), entirely in your browser with pdf-lib. To also strip metadata, attachments, and annotations, use Sanitize PDF.

  • Every script vector

    Document scripts, OpenAction, open/print triggers, and form calculation logic.

  • Safer to open & share

    Removing scripts closes a common malware hiding spot in PDFs.

  • Links are kept

    Clickable links use link actions, not JavaScript, so they keep working.

  • Deleted, not unlinked

    Script objects and their source are removed, so the code doesn't linger.

How to remove JavaScript from a PDF

  1. Add your PDF(s)

    Drop one file (or up to 30) into the upload area.

  2. Remove the scripts

    Click “Remove JavaScript”. Every embedded script (document actions, open actions, and form scripts) is stripped from each file.

  3. Download

    Download your cleaned PDF (a ZIP for several). Everything happens in your browser.

Frequently asked questions

Are my PDF files uploaded to a server?
No. JavaScript is removed entirely in your browser using pdf-lib. Your files never leave your device. You can confirm it in your browser's Network tab: no file data is sent.
What kinds of JavaScript are removed?
All of the common vectors: document-level scripts, a script that runs when the file opens (OpenAction), document and page trigger actions (on open/close/print/save), scripts attached to annotations, and a form's calculation, format, and validation scripts. Each script object and its source are deleted from the file, not just unlinked.
Why would a PDF contain JavaScript?
PDFs can carry scripts for interactive forms (auto-calculating totals, validating input), but scripts are also a common way malware hides in a document. Removing them makes a PDF safer to open and share, at the cost of any interactive form logic.
Will removing scripts break my PDF?
The pages, text, and images are untouched, so the document still reads normally. Only interactive behaviour that depended on a script (for example a form field that auto-calculates a total) stops working. Clickable links are kept. They use link actions, not JavaScript. To remove links, use Remove Links.
Can I clean several PDFs at once?
Yes. Add up to 30 PDFs. One file downloads as a cleaned PDF (with its original name), and two or more download together as a single ZIP.