How to redact an API key in a Mac screenshot (and why blur is not enough)
To redact an API key in a Mac screenshot, cover it with a solid, opaque bar, not a blur, then check the exported image before you post it. Blur and pixelation change the pixels but do not delete the information, and published research has shown that light versions can sometimes be reversed. If a real key has already been posted, redacting is too late. Rotate it.
Why is blur not enough to hide an API key?
Blur and pixelation are transformations. They turn sharp text into something fuzzier, but the result still depends on what was underneath. That dependence is what researchers exploit.
- In 2016, Hill, Zhou, Saul and Shacham applied hidden Markov models, a technique from speech recognition, to reconstruct text from mosaiced and blurred images. They tested across typefaces, font sizes, grid sizes and offsets, and concluded both methods are inadequate for hiding text (PoPETs 2016).
- Depix, an open source proof of concept, recovers text from pixelated screenshots made with a linear box filter. Its own README states limits: it does not work if extra image compression is applied, and some modern text rasterizers position text at sub-pixel accuracy, which breaks it.
- In 2022, Bishop Fox released Unredacter, which reverses pixelated text when the attacker knows the font, font size and block size. Its author's conclusion was that "the only way to do it securely is to use black bars."
Be honest about the limits. These attacks assume things like a known font and a light, predictable filter, and the research I found does not show reliable recovery of an arbitrary random 40-character key from a heavy blur. But "probably hard" is a poor foundation for a secret. A solid bar removes the question entirely.
What is the right way to redact a screenshot?
Replace the pixels with an opaque shape. A black or solid-color bar over the text means there is nothing left underneath to analyze, as long as the bar is part of the exported image and not a layer sitting on top of the original.
That last point is where "redaction" fails in practice:
- A 2019 court filing drew black boxes over text in a PDF without removing the text underneath, and copy and paste revealed it.
- In 2023, "aCropalypse" showed that the Pixel's Markup tool and the Windows 11 Snipping Tool could leave old image data after the end of a saved file, so cropped screenshots could be partly recovered.
So the checklist is short. Use an opaque bar. Export to a new image. Open the exported file, not the editor, and look at it. If the original and the edited file are both on your disk, make sure you post the edited one.
How do you check a screenshot for secrets before posting?
Do a slow pass over the whole image, not just the part you meant to show. Leaks are often incidental: a token in a terminal tab, an email in a corner, a meeting ID in a title bar, a sticky note in the background.
Look for:
- API keys and tokens, including ones inside URLs and config lines
- Email addresses
- IP addresses
- Card numbers
- Window titles, tabs and notifications that show account or project names
Then zoom in. Small text at the edge of a retina screenshot is easy to miss at full size.
What if a key was already posted?
Treat it as compromised and rotate it. Every provider I checked says the same. Stripe: "If a restricted or secret API key is exposed or compromised, rotate it immediately even if you aren't sure anyone saw it." Anthropic recommends revoking a key immediately if you suspect it is compromised. GitHub's guidance on leaked secrets says the first step is to revoke or rotate it.
Speed matters. In a 2023 Unit 42 experiment, researchers leaked AWS keys on public GitHub, and an attacker detected and used them within five minutes. That was a code repository, not a screenshot, but the lesson carries over: the clock starts when the key becomes visible. And old keys do not expire on their own. GitGuardian found that secrets confirmed valid in 2022 were still more than 64% valid when retested in January 2026, and Truffle Security re-checked 10,616 leaked AWS keys in August 2026 and found 88% still worked.
Deleting the post helps the next viewer. Rotating the key protects you from everyone who already saw it. Do the second one first.
How does ScreenPost redact secrets automatically?
I built auto-redact into ScreenPost because I post screenshots of real dashboards and terminals, and checking every corner by hand is exactly the step people skip. One click runs on-device OCR over the capture and finds emails, API keys, IP addresses and card numbers. Each match gets an opaque bar. Only the secret value is covered, so in a line like KEY=... the label stays readable and the screenshot still makes sense. The capture, editing and redaction happen on your Mac.
The editor's blur tool also says something I agree with. Pixelate and blur are for hiding detail, not secrets, and at low intensity the property bar tells you "For sensitive text use Redact (D)", which paints an opaque bar.
OCR can miss text, so look over the result before you post. That applies to any automatic tool, including Xnapper's automatic redaction and anything else you try. If you want the broader picture of what a good editor does, see the best screenshot editor for Mac, and for the capture shortcuts see how to take a screenshot on a Mac and post it to X.
FAQ
Can pixelated text be unpixelated? Sometimes. Published research and open source tools have reversed light pixelation, usually when the attacker knows the font and block size. A solid bar avoids the question.
Is blur ever safe for text? Do not rely on it for a secret. For something harmless, like softening a background face, it is fine.
How do I permanently remove text from a screenshot? Cover it with an opaque bar in an editor, export a new image, and check the exported file. Do not post the original.
I posted a key by accident. What now? Revoke or rotate it at the provider first, then delete the post.