Skip to main content
PPDF123

Invert or Recolor a PDF

Replace and Invert Colors recolors a PDF by full inversion, a high-contrast pair such as white on black, one custom color, or greyscale. Text stays selectable because color operators are edited, not pages rasterized.

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.

Replace / Invert Color rewrites the colour-setting operators in the page and form content streams (`rg`, `RG`, `g`, `G`, `k`, `K`, `sc`, `scn`) and, for the inversion modes, the image `/Decode` arrays, inline-image samples, annotation colours and shading stops.

Four modes. `FULL_INVERSION` flips every colour set explicitly in the page, so white text and fills become black and the reverse; a page with no painted background stays white. `HIGH_CONTRAST_COLOR` paints a solid background and redraws the content in one of four foreground/background pairs: white on black, black on white, yellow on black or green on black. `CUSTOM_COLOR` replaces every colour with a hex value you choose. `COLOR_SPACE_CONVERSION` runs Ghostscript's `pdfwrite` device with `-sColorConversionStrategy=Gray` to convert the whole document to greyscale.

Text stays selectable, because this edits colour operators rather than rasterising pages. In `FULL_INVERSION` images are inverted through their `/Decode` arrays, so they remain images and simply become negatives. `HIGH_CONTRAST_COLOR` and `CUSTOM_COLOR` leave images unchanged.

The mode names describe what happens to explicitly painted colour, and the distinction between them matters on real documents. Most Word and PowerPoint exports paint a white rectangle behind the text, so `FULL_INVERSION` turns that rectangle black and the text white - a dark page. A PDF that leaves the page background implicit, with no fill painted, has nothing to invert, so the paper stays white and only the ink changes to white as well, which can make the text invisible. If a full inversion comes back looking blank, the file had an unpainted background; `HIGH_CONTRAST_COLOR` is the mode that paints a background for you.

High contrast and custom colour are blunt tools. Both replace every explicit colour in the content stream, not just text, so a chart with a coloured legend, a table with shaded rows, or a logo built from fills all collapse to the single chosen foreground. That is acceptable when the goal is legibility on an e-reader or a mono laser printer, and wrong when the document's colours carry meaning such as a red overdue balance. Preview a page with colour before you replace a whole report.

The grayscale mode is a different mechanism entirely. The three rewrite modes edit operators in place; `COLOR_SPACE_CONVERSION` sends the file through Ghostscript's `pdfwrite` device with a grey conversion strategy, which genuinely re-renders the document. The visual result is a true greyscale version including images, but it is a heavier operation that depends on Ghostscript being installed on the server, and it can move text slightly because the file is rewritten rather than patched. Use it when you want a real greyscale print, and one of the rewrite modes when you only need darker ink.

Accessibility cautions apply to every mode. Forcing white on black or black on white overrides whatever contrast the author designed, and it can leave a page that was hard to read in colour equally hard in monochrome. This is a visual transformation, not a contrast audit; run your own checking pass on the output before treating the document as accessible.

Password-protected files are unlocked for you on this page once you enter the password; API callers run Unlock first. The grayscale mode needs Ghostscript on the server.

Features

  • Content-stream colour rewrite: rg / RG / g / G / k / K / sc / scn
  • Inversion modes also flip image `/Decode` arrays, inline images, annotation colours and shading stops
  • Four modes: full inversion, high contrast, custom colour, grayscale
  • Rewrites operators in place; grayscale mode re-renders through Ghostscript
  • Anonymous API at /api/v1/misc/replace-invert-pdf

When to use this tool

  • Turn a white-background deck into a dark, low-glare copy
  • Prepare a high-contrast print for a low-vision reader
  • Convert a colour report to grayscale before a mono print run
  • Darken faint text so it reads on an e-ink screen

How do I invert the colors of a PDF?

  1. Upload the PDF whose colours you want inverted, recoloured, or converted to greyscale.
  2. Choose a mode under Color transform.
  3. For high contrast, pick a contrast combination; for custom colour, pick the replacement colour.
  4. Click Process and download the recoloured PDF.

Limits and edge cases

  • A colour rewrite, not an accessibility audit: check the result before publishing
  • High contrast and custom colour recolour fills as well as text; check pages with coloured backgrounds
  • Grayscale mode needs Ghostscript; the endpoint returns 503 without it
  • Password-protected files need the password; API callers run Unlock first
  • Full inversion can blank a page with no painted background
  • 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 white slide with black text becomes black with white text under High contrast → White text on black
  • Full inversion on a scanned page turns it into a photographic negative
  • Color space conversion turns a colour chart into true greyscale including its images

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

What did high contrast apply?
The chosen background is painted behind each page and every explicit colour, fills as well as text and lines, is replaced with the chosen foreground. A white slide deck becomes readable in low light, but shapes and table fills also take the foreground colour.
Is the text still selectable?
Yes. The content stream is rewritten, so the text operators and glyphs are unchanged — only their colour is.
Are images inverted?
Only in Full inversion, which flips each image's `/Decode` array (and inline-image sample bytes) so photos become negatives. High contrast and custom colour leave images unchanged.
What does color space conversion do?
It runs Ghostscript's pdfwrite device with a grey colour-conversion strategy, converting colour images and fills to grayscale.
Does it need Ghostscript?
Only for the color space conversion mode. The other three modes are pure PDF rewrites with no external binary.
Why did Full inversion give me a blank page?
The PDF had no painted background, so only the ink flipped to white. Use High contrast, which paints a background first, when the source page is plain white paper.
Will charts and table colours survive?
Not exactly. High contrast and custom colour replace every fill, so coloured charts and shaded rows take the single foreground colour. Check a colour-heavy page before converting a whole report.

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/misc/replace-invert-pdf" \
  -F "[email protected]" \
  -F "replaceAndInvertOption=HIGH_CONTRAST_COLOR" \
  -F "highContrastColorCombination=WHITE_TEXT_ON_BLACK" \
  -F "customColor=#000000" \
  -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 Replace & Invert Colors for you with this skill: /skills/pdf123-replace-invert-color.md

All agent skills

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