Skip to content
DevToolKit

PDF Change Colors

Convert PDF colors between color spaces online for free. Switch between RGB, CMYK, and grayscale. All processing in your browser.

pdf

Drop your PDF here, or click to browse

Files are processed entirely in your browser — never uploaded

Processed locally
Was this tool helpful?

How to Use

Replace colors in your PDF in four steps:

  1. Upload your PDF — Drag and drop or click to browse. The tool reads the file locally in your browser.
  2. Pick source and target colors — Set the color you want to replace using the color picker or hex input. Set the replacement color the same way.
  3. Configure matching options — Adjust the tolerance slider to match near-colors. Toggle whether to replace fill colors, stroke colors, or both. Optionally limit to specific pages.
  4. Replace and download — Click Replace Colors to process. The tool reports how many replacements were made. Download the modified PDF.

All processing runs in your browser using pdf-lib. No files leave your device.

About This Tool

PDF color replacement operates on the raw content streams that define how pages are rendered. Unlike CSS or HTML where colors are declared in stylesheets, PDF embeds color values directly in the drawing instructions that compose each page. This tool parses those instructions to find and replace specific color values.

How PDF content streams encode colors

A PDF content stream is a sequence of operators and operands written in PostScript-like syntax. The color operators rg (set fill color) and RG (set stroke color) take three floating-point operands representing red, green, and blue values in the 0.0-1.0 range. For example, 1 0 0 rg sets the fill color to pure red, while 0 0 0.5 RG sets the stroke to dark blue.

Tolerance matching for real-world PDFs

Real-world PDFs rarely use exact color values. A document might use 0.937 0.231 0.173 rg instead of a clean 1 0 0 rg for what visually appears as red. The tolerance setting compares each RGB channel — a 10% tolerance accepts values within 0.1 of the target on each channel. This catches color variations from different PDF generators, rounding differences, and color profile conversions.

Fill versus stroke colors

PDF maintains two independent color states: the fill color (used for text glyphs, filled shapes, and backgrounds) and the stroke color (used for lines, borders, and outlines). The lowercase operators rg, g, k control fill; uppercase RG, G, K control stroke. Targeting them separately allows precise control — for example, changing red text to blue while leaving red border lines untouched.

All processing happens client-side in your browser. For global color adjustments like brightness and contrast, use PDF Adjust Colors. To convert all colors to grayscale, try PDF to Greyscale.

Why Use This Tool

Replacing specific colors in PDFs serves several professional purposes:

  • Brand updates — When a company changes its brand colors, existing PDF documents need updating. This tool replaces the old brand color across all text and graphics without recreating the document.
  • Print preparation — Certain colors render poorly on specific printers. Replacing problematic colors (like light yellows that disappear on white paper) with more printable alternatives ensures readable output.
  • Accessibility compliance — WCAG requires sufficient contrast between text and background. Replacing low-contrast text colors with darker alternatives makes documents accessible without layout changes.
  • Template customization — PDF templates with placeholder colors (often bright magenta or cyan) need their accent colors replaced when creating final documents for different clients or departments.
  • Document standardization — Combining PDFs from multiple authors often produces inconsistent color usage. Standardizing a specific blue or red across all pages creates visual consistency.

Processing locally ensures brand assets and confidential documents remain on your device throughout the entire operation.

FAQ

Can I convert a PDF to grayscale?
Yes. Convert all colors in the PDF to grayscale for printing or to reduce visual complexity.
Does this handle CMYK conversion?
Yes. Convert between RGB and CMYK color spaces for print preparation workflows.
Is my PDF uploaded?
No. All processing happens locally in your browser.