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.
The flags map to specific PDF structures, and knowing which one you need matters. `removeJavaScript` clears the catalog-level `OpenAction` and `AA` entries, the ones that run as soon as a file opens. `removeEmbeddedFiles` drops the EmbeddedFiles name tree, which is where attached spreadsheets, executables, or archive bombs hide. `removeMetadata`, `removeXMPMetadata`, and `removeInfoMetadata` strip the document properties a recipient could otherwise read. `removeLinks` turns clickable link annotations into plain text. `removeFonts` is the risky one and stays off unless you have a specific reason.
Removing links is a subtle point. A link annotation is invisible until you hover it, so a PDF can carry destinations you never notice - to a tracking URL, an internal file path, or a domain that no longer belongs to the sender. That is why links default to being removed: a forwarded document has no legitimate reason to route a reader somewhere the new recipient did not expect. If the links are real navigation your recipient needs, turn the flag off deliberately.
Metadata stripping is what most people actually want from a share-hygiene pass. Author names, the creating application, original file paths, and revision history live in the Info dictionary and in XMP. Removing them prevents a recipient from learning who edited the file and on what machine, which is a common leak when a document leaves the organization it was made in.
Sanitize does not touch the page content stream. Text, images, and vectors are copied through unchanged, which is why it is safe to run on a document whose appearance must not change and dangerous to run when you were hoping it would hide a name printed on the page. The list of things it cannot remove is long: text, image pixels, bookmarks, form fields, named JavaScript, annotation actions, and attached-file references outside the name tree. Show JavaScript is the right companion to confirm what script remains.
Order of operations matters when you combine tools. Extract any attachments you still need before sanitizing, because `removeEmbeddedFiles` deletes them. If you also need to redact visible secrets, do that on the cleaned file, since redaction paints over content and is unaffected by dictionary removal. If a signature must survive, check it before sanitizing; stripping the document's metadata changes the bytes and can break a signature's integrity check.
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`.
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
- Does not alter page content, text, or images
- 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
- Clear author and path metadata before a document leaves the organization
How do I remove JavaScript and metadata from a PDF?
- Upload a PDF you are authorized to clean before sharing.
- Leave the defaults unless you know you must keep links or metadata. Keep removeFonts off unless you mean it.
- Click Process and download the cleaned PDF.
- 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
- Does not remove bookmarks, form fields, or page content
- Stripping metadata can invalidate a digital signature
- 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
- With removeLinks on, a clickable footer URL becomes ordinary text
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.
- Why are links removed by default?
- Link annotations can point to tracking URLs, internal paths, or old domains. A forwarded document usually should not route its new reader, so removal is the safe default. Turn it off if the links are real navigation.
- Does sanitize hide names printed on the page?
- No. It never touches page content. Visible text stays visible; use Auto Redact for that. Sanitize only removes the metadata and structure around the content.
- Will my attachments still be there?
- No, when removeEmbeddedFiles is on. Extract anything you need before sanitizing, because that flag drops the whole embedded-files tree.
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.pdfAlso 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
SkillClaude Code, Codex, Cursor and other AI agents can run Sanitize PDF for you with this skill: /skills/pdf123-sanitize.md
Files are used only for this processing job and deleted automatically afterward.