Skip to main content
PPDF123

Sanitize a PDF Before Sharing

Sanitize PDF removes selected active and hidden content from a PDF: document-open and additional JavaScript actions, embedded files, XMP and Info metadata and link annotations, with optional font removal. It is share hygiene, not an antivirus scan or redaction.

Drag and drop files here, or click to choose

Accepts PDF · up to 500.0 MB per file · up to 20 files at once

You can also paste a file with Ctrl/Cmd+V, or from the clipboard menu.

Sanitize removes selected active extras from a PDF before you forward it: catalog JavaScript hooks (`AA`, `OpenAction`), XMP Metadata, the EmbeddedFiles name tree, the trailer Info dictionary, page-level `AA`, Link annotations, and, if you turn it on, page Font resources.

The portal defaults are on for JavaScript, embedded files, XMP, Info metadata, and links. `removeFonts` defaults to off, for good reason: stripping Font resources can make text disappear or render as boxes. Called through the API, nothing is removed unless you pass each `removeX=true` flag.

This is dictionary surgery on the loaded PDF, not qpdf `--sanitize`, not an antivirus scan, and not redaction. Visible names and numbers stay on the page. Use Auto Redact when secrets in the text must go.

Attachments you still need should be extracted first. Sanitize a copy for distribution. Calculations that depend on the document-open action may stop. JavaScript stored in the named-scripts tree, in form fields or in annotation actions is not removed; Show JavaScript lists what remains. Flatten is a different job: it paints annotations into content rather than removing active catalogs.

Only sanitize files you are allowed to modify. Stripping audit metadata from a record you must keep intact can be improper.

Password-protected files are unlocked for you on this page once you enter the password; API callers run Unlock first. After the download, open the PDF and confirm the pages you need still render, especially if you enabled `removeFonts`.

Treat sanitize as share hygiene, not a security certification. Hostile PDFs can still be hostile after these keys are gone.

Features

  • Removes catalog JS hooks, XMP, Info, embedded-file names, and Link annots when those flags are on
  • Font removal is optional and off by default
  • Not a malware scanner and not redaction
  • Anonymous API at /api/v1/security/sanitize-pdf

When to use this tool

  • Clean a vendor PDF before forwarding internally
  • Strip unexpected EmbeddedFiles before publishing
  • Remove link annots from a file that should not stay clickable

How do I remove JavaScript and metadata from a PDF?

  1. Upload a PDF you are authorized to clean before sharing.
  2. Leave the defaults unless you know you must keep links or metadata. Keep removeFonts off unless you mean it.
  3. Click Process and download the cleaned PDF.
  4. Open the file and confirm pages still render. Run Auto Redact separately if visible secrets must go.

Limits and edge cases

  • Not a malware scanner
  • May disable script-dependent features
  • JavaScript in the named-scripts tree, form fields and annotations is not removed
  • Visible secrets need redaction, not only sanitize
  • Upload limit on this website: 500 MB per file, sent in chunks above about 95 MB. A single direct API request body is capped at 100 MB.

Examples

  • A PDF with an EmbeddedFiles name tree loses that tree when removeEmbeddedFiles is true
  • A file whose only script is a document-open action no longer runs it after removeJavaScript

Privacy for this tool

Files are uploaded over HTTPS, processed in memory or a short-lived temporary directory on our servers, and deleted when your result is ready. We do not keep copies for later browsing, training, or advertising profiles. See the Privacy Policy for retention details and AdSense cookie disclosures.

Frequently asked questions

Does sanitize remove passwords?
No. Use Unlock for encryption you are allowed to remove.
Will my form fields still work?
Sanitize removes the document-open action and the additional actions on the catalog and pages. Field-level scripts such as calculations are not removed. Test the file before sending it.
Is this the same as flattening?
No. Flatten paints annotations into page content. Sanitize deletes selected catalogs, names, and annots.
Can sanitize guarantee a malware-free file?
No. It removes the listed dictionaries. It is not a scanner and not a certification.

Last updated:

Call this from code

Every tool on this site is a plain REST endpoint - no account or API key needed for anonymous use. Built for AI agents and developers as much as for browsers.

curl -X POST "https://pdf123.xyz/api/v1/security/sanitize-pdf" \
  -F "[email protected]" \
  -F "removeJavaScript=true" \
  -F "removeEmbeddedFiles=true" \
  -F "removeXMPMetadata=true" \
  -F "removeMetadata=true" \
  -F "removeLinks=true" \
  -F "removeFonts=false" \
  -o output.pdf

Also available as an MCP tool for agent clients that speak Model Context Protocol (JSON-RPC 2.0 over POST /mcp). Full API reference

Use it from an AI agent

Skill

Claude Code, Codex, Cursor and other AI agents can run Sanitize PDF for you with this skill: /skills/pdf123-sanitize.md

All agent skills

Files are used only for this processing job and deleted automatically afterward.