Invert PDF colors for dark-mode reading

Inverting a PDF's colors flips every pixel to its opposite — white page backgrounds become black, black text becomes white — producing a dark-mode copy you can read comfortably at night in any viewer, even ones with no theme setting. This page re-renders each page in your browser and inverts the RGB value of every pixel, then saves the result as a new PDF. Color photographs come out looking like film negatives, so treat the output as a screen-reading copy, not a print file, and keep the original for printing and archiving.

Invert PDF colors — runs on your device

How it works

A PDF stores its colors deep in drawing instructions — fill colors, stroked paths, embedded images in various color spaces — and there is no single switch inside the format that means "dark mode." Rewriting every color operator in place would break on gradients, transparency groups, and CMYK images, so this tool takes the reliable route: it renders each page exactly as it would appear on screen, then transforms the flattened result.

Rendering is done by pdf.js, the engine Firefox uses to display PDFs, drawing each page onto an off-screen canvas at reading resolution. The inversion itself is the simplest transform in image processing: for each pixel, the new red value is 255 minus the old red, and likewise for green and blue (Y = 255 − X per channel). Pure white (255, 255, 255) maps exactly to pure black and vice versa; a light gray becomes an equally dark gray, so the tonal relationships in text, rules, and shading are preserved — just mirrored around the midpoint. The alpha channel is untouched.

The same arithmetic is what makes photographs come out as negatives: a blue sky (dominant blue channel) inverts to its complement, an orange-yellow; skin tones swing toward cyan. Uniform inversion cannot distinguish a picture from the page background, and the smarter alternatives — detecting image regions and leaving them alone — misfire often enough on charts and screenshots that this tool deliberately keeps the transform predictable instead.

Each inverted bitmap is re-encoded and placed onto a page of the original dimensions with pdf-lib. The output is a rasterized reading copy: identical layout, dark everywhere, but with text stored as pixels rather than glyphs, so nothing is selectable or searchable in it. For a printable tonal change rather than a screen one, Grayscale PDF is the tool with the print-friendly transform.

Illustrative example: a 210-page textbook chapter set for night reading

Illustrative scenario, not a recorded benchmark. File sizes, timings and results depend on the input and device. Try the reproducible samples.

A student's 210-page compiled lecture-notes PDF (12.6 MB, white background, black 11 pt text, occasional blue headings and diagrams) is uncomfortable to read in bed — at minimum tablet brightness the white page still dominates a dark room. Running it through this tool takes about 2 minutes on a mid-range laptop; progress is shown per page.

The output is a 14.1 MB file — slightly larger because 210 freshly encoded page images replace efficiently stored text — with black pages, white body text, and the blue headings now rendered in their complement, a warm yellow-orange that still reads clearly against black. The 14 diagrams with white backgrounds invert cleanly; two photographs of whiteboards come out as negatives, which the student ignores since the handwriting is still legible as light-on-dark. On the tablet the black background emits almost no light at the same brightness setting, and on its OLED screen the black pixels are simply off. The original file stays untouched for printing and for copying quotes into assignments.

Frequently asked questions

How do I invert a PDF's colors for dark mode?

Use a tool that re-renders each page and flips every pixel's RGB values, so the white page becomes black and black text becomes white. This page does that in your browser and saves the result as a new PDF you can read in any viewer, including ones with no dark-mode setting of their own.

Why do photos look like negatives in the inverted file?

Inversion is applied to every pixel uniformly, and it cannot tell a photograph from the page background, so image colors flip too — skies go orange, faces go cyan, exactly like a film negative. That is the accepted trade-off of a reading copy; text-heavy documents invert cleanly, photo-heavy ones less so.

Can I print the inverted PDF?

You can, but you should not want to — printing it would lay solid toner across the entire page background and drain a cartridge in a few dozen pages. The inverted file is a screen-reading copy; always print from the original.

Is inverting better than my PDF reader's night mode?

A reader's night mode does a similar flip live but only inside that app; an inverted file is dark everywhere — in browsers, on e-ink tablets, on a phone viewer with no theme setting, or when you send it to someone else. Use the reader setting when you have it, and this tool when you do not or when the dark version needs to travel with the file.

Does inverting reduce eye strain at night?

In a dark room, a white page is often the brightest object in view, and reducing that glare is why many people find light-on-dark text more comfortable at night. Research on actual eye strain is mixed, so treat it as a comfort preference rather than a health claim.

Is the text in the inverted copy still selectable?

No — pages are rebuilt as inverted images, so the text layer is not carried over and you cannot select or search text in the output. Keep the original for searching and quoting, and use the inverted copy just for reading.

Related tools