Redact all occurrences of a word in a PDF

Redacting a PDF means permanently removing sensitive content, not merely covering it with a box. This tool finds every occurrence of a search term in the PDF's selectable text layer, case-insensitively, blacks each one out, and then flattens every affected page to an image so the text underneath is destroyed and can no longer be copied, searched or extracted. Everything runs in your browser; the document is never uploaded.

Redact by search — runs on your device

How it works

The most common redaction failure is cosmetic redaction: a black rectangle drawn over a name in a viewer that leaves the name itself sitting in the page's content stream. Anyone who selects the area and copies, or extracts the text programmatically, recovers the “redacted” content — a mistake that has embarrassed courts and government agencies repeatedly. Real redaction has to remove the text objects, not just hide them.

This tool does it in two stages. First it searches: the pdf.js library parses the text layer of every page and returns each text run with its exact coordinates on the page, and the tool matches your term case-insensitively against those runs, computing a covering rectangle for every occurrence. Second it destroys: each page that contains at least one match is rendered to a canvas at print resolution with black rectangles painted over all the matches, and the rendered bitmap then replaces the original page content via pdf-lib. After that flattening step, the page consists of a single image — the fonts, text runs and vector drawing operators that used to make up the page, including every redacted word, are simply gone from the file.

The trade-offs follow from the mechanism. Flattened pages stop being selectable and searchable, and their file size changes because vector content becomes image data. And because matching reads only the selectable text layer, it cannot see words that exist as pixels inside scans, screenshots or photos — those occurrences will not be found. For images, or for one-off marks, use the manual redaction tool, which lets you draw black boxes exactly where you want them and flattens the result the same way. Either way, page through the output before you share it: automated matching is a power tool, not a substitute for a final human check.

Worked example: removing a client name from a contract

A 12-page consulting contract (240 KB) had to be shared as a work sample with the client's name removed. Searching for Acme GmbH found 29 occurrences on 9 of the 12 pages, including “ACME GMBH” in the header block, thanks to case-insensitive matching. Those 9 pages were flattened to images; the 3 untouched pages kept their original text. The file grew from 240 KB to 3.1 MB — the expected cost of turning vector pages into bitmaps — and a copy-paste test across a redacted paragraph produced no text at all. One catch surfaced during review: the company logo, an image containing the name, was untouched by the search, and was covered afterwards with the manual redaction tool.

Frequently asked questions

Does drawing a black box over text really remove it?

An ordinary black rectangle only covers text — the words are still in the file and can be copied out from underneath. This tool goes further: after blacking out each match it flattens the affected pages to images, so the underlying text objects no longer exist in the output.

Why can I no longer select text on the redacted pages?

Flattening replaces the page's text and vector content with a single rendered image, and that is exactly what destroys the redacted text. Losing selection and search on those pages is the trade-off that makes the redaction permanent.

Can this redact text inside scanned pages or pictures?

No. The search only sees the selectable text layer, and words that exist as pixels inside a scan, screenshot or photo are invisible to it. For those, draw redaction boxes by hand with a manual redaction tool.

Should I check the output before sharing it?

Yes, always page through the result before it leaves your hands. Automated matching can miss a term that is split across lines, spelled differently or embedded in an image, and no software should be trusted blindly with sensitive data.

Is the redaction search case-sensitive?

No. Matching is case-insensitive, so searching for acme also finds Acme and ACME. That reduces the risk of an occurrence slipping through because of capitalization.

Is my confidential PDF uploaded for redaction?

No. Searching, blacking out and flattening all happen in JavaScript inside your own browser, which is exactly where you want redaction of sensitive files to happen. The document never touches a server.

Related tools