BASALT · JOURNAL

Removing a black box from a PDF, and what it means that you can

2026-08-07 · how to remove black box from pdf

People search how to remove black box from PDF pages for two different reasons, and the honest answer is the same for both: if the box is an annotation, it deletes in a single operation and the text underneath is completely intact. That is not a trick or an exploit, it is the documented behavior of a comment object, and it is precisely why drawing a box is not redaction.

This article is written for testing your own documents. If you drew a box over a client name and want to know whether the file is safe to send, the procedure below is the test. Run it on a copy of your own file and act on the result.

Two reasons people search how to remove black box from PDF

The first is that you received a document with a box on it and cannot read a value you need. The second is that you drew the box yourself and want to know whether it protected anything.

Those two situations look identical from the file's perspective, which is the whole problem. A file where the words were excised and a file where a rectangle was painted over them render the same black bar at every zoom level. Nothing about the appearance distinguishes them.

The removal mechanism is described here because you need it to audit your own work, not to open other people's confidential material. Defeating a third party's redaction of information you were not given is a different activity with different consequences, and this is not a guide for it.

Why the box comes off so easily

Most black boxes in PDFs are annotations. Markup tools in Preview, in Mail, and in most annotation-first apps create an object in the page's /Annots array: a dictionary with a rectangle, a subtype such as /Square, a color, and an appearance stream.

Annotations exist to be added and removed. They sit alongside the page content rather than inside it, and stripping them is a structural edit that any conforming library performs without touching a single text operator. When the annotation goes, the page underneath renders exactly as it did before, because it was never modified.

The second common case is a box drawn into the content stream itself, as fill operators after the text. Deleting the annotation does nothing there, but the words are still present in the Tj and TJ operators regardless of what is painted on top, so extraction returns them anyway.

Testing your own file

Work on a copy. Install Poppler and qpdf with Homebrew, then start with the cheapest check.

pdftotext -layout mydoc.pdf - | grep -i "confidential-term"

If the term you thought you removed comes back, the box was cosmetic and the file is not safe. A clean result proves less than it looks like, because fonts without a usable /ToUnicode map can hold the original character codes while producing empty output.

Expand the file so the structure is readable as plain text and look for annotations near the box.

qpdf --qdf --object-streams=disable mydoc.pdf expanded.pdf
strings expanded.pdf | grep -i "confidential-term"

In expanded.pdf, search for /Annots and for /Subtype /Square. A rectangle in an annotation dictionary, with the text still present in the content stream below it, is the exact signature of a document that will unredact itself for anyone who deletes comments.

If the redaction covered a scan, extract the images and open them directly, since a page-level box does nothing to the pixels inside an embedded image object.

pdfimages -all mydoc.pdf ./extracted/img

Finally, count generations, since more than one end-of-file marker means earlier revisions are still in the file and one of them may be the page before you covered anything.

strings mydoc.pdf | grep -c "%%EOF"

A longer version of this sequence, with the metadata and attachment checks included, is in how to verify a PDF redaction. If the terms come back at any stage, the situation is the one described in your redacted PDF still shows the text.

What to do when the box fails the test

Go back to the original document rather than repairing the marked-up copy. A repaired copy can still carry the pre-redaction page in its update chain, and it will have accumulated metadata and thumbnails from the failed attempt.

Real removal means editing the content stream. The text-showing operators are parsed into individual glyph runs with real page coordinates, accounting for the text matrix, font size, horizontal scaling, character and word spacing, and the kerning numbers inside a TJ array. Covered glyphs are excised and the survivors re-emitted at their original positions.

Where the content is pixels, the pixel data under the mark is overwritten and the image re-encoded, so the original DCTDecode stream cannot be pulled out whole. Where the page carries an invisible OCR layer drawn in text rendering mode 3, that layer has to be excised at the same coordinates as the visible mark.

Then the file is written as a single generation with a fresh cross reference table, and the carriers that are not on any page are cleared in the same pass: the document information dictionary, the XMP packet, embedded attachments, optional content groups, annotation /Contents strings, and stale thumbnails. What a PDF still carries after you think you cleaned it lists the full set.

Frequently asked questions

How do I remove a black box from a PDF I made myself?

Open the file with a tool that can strip annotations, or expand it with qpdf --qdf --object-streams=disable and look for a /Square annotation in the page's /Annots array. If the box lives there, deleting that object removes it and reveals whatever is underneath. Do this only on your own documents, as a test of whether the mark protected anything.

If I can delete the box, does that mean the PDF was never redacted?

Yes. A real redaction removes the glyphs from the content stream, so there is nothing to reveal when the covering is taken away. If deleting a rectangle brings text back, the words were present in the file the entire time and every recipient had access to them. Redo the work from the original file.

Can I remove a black box that was flattened into the page?

The box itself cannot be deleted as an object once it is part of the content stream, but that does not protect the text. Extraction reads the text operators directly and ignores what is painted over them, so pdftotext will still return the words. Flattening changes how hard the covering is to peel off, not whether the content is present.

Should I try to see under a redaction in a document someone sent me?

No, not when the material was redacted deliberately and was not shared with you. The technique described here is for auditing files you own before you distribute them. If you believe a production you received was redacted incorrectly, the appropriate step is to raise it with the sender or through whatever process governs the exchange.

Why does Preview let me delete a redaction box?

Because Preview's markup tools create annotations, and annotations are removable by design. Preview is not claiming to redact anything, it is drawing a shape and offering you the ability to undo it. The wider issue with using it for this purpose is set out in why redacting in Preview is not redaction.

Does a black box hide text from search engines and indexers?

No. Anything that extracts text from the file, including desktop search, document management systems, e-discovery platforms, and web crawlers, reads the content stream and returns the covered words. A published document with cosmetic black boxes can become searchable by its own hidden text within hours of going online.

How can I be sure the box removal test is thorough enough?

Run text extraction, structural inspection of the expanded file, image extraction, and a count of end-of-file markers, then check metadata with exiftool and attachments with pdfdetach -list. Any single check passing is weak evidence, and the combination is what gives you confidence.

What replaces a black box if a black box is not redaction?

A redaction operation that excises the glyphs and re-encodes any covered image pixels, then draws a mark so readers can see something was removed. The visible black bar is fine and often required, it just has to be the last cosmetic step after the content is gone, rather than the whole operation. Permanently deleting text from a PDF describes what that involves.

Doing it in Basalt

Basalt treats the mark as the last cosmetic step rather than the operation: text under a redaction is excised from the content stream glyph by glyph, surviving text is re-emitted in place, image pixels are destroyed and re-encoded, and the result is written as a single generation so earlier versions cannot be recovered. Before anything is saved, a verifier re-opens the written file with an independent parser and proves the content is gone, and if it cannot prove that, nothing is written and it tells you why. The Inspector shows you, for any file you own, what it still carries off-page: metadata, XMP, embedded files, hidden layers, OCR text, JavaScript, and saved generations. Every tool writes a new file and the original is never modified, and the engine has no network entitlement, enforced by macOS at the code signature level, so nothing leaves your Mac. It is $29 once, lifetime, up to three Macs, free for 24 hours.

Redaction that proves itself

Basalt destroys the content you mark, then re-opens the file it wrote and proves the content is gone before it saves anything. Your documents never leave your Mac.

DOWNLOAD BASALT 2.3.0 BUY $29 FREE FOR 24 HOURS · MACOS 13+