Color Swapper — Swap Two Colors in an Image

Upload an image, pick two colors, and exchange them both ways — adjustable tolerance, smooth edges, free.

A free online color swapper that exchanges two colors at once — every pixel matching color A becomes color B, and every pixel matching color B becomes color A, in a single pass. Tune the tolerance to catch similar shades, optionally preserve the original shading, and keep swapped boundaries anti-aliased with smooth edges — then download a transparent PNG. Everything runs in your browser; nothing is uploaded.

What is a color swapper?

A color swapper exchanges two colors in an image simultaneously — everywhere the first color appears becomes the second, and everywhere the second appears becomes the first, in one pass. That's different from a one-directional color replacer, which only changes one color and leaves the other untouched. Swapping is exactly what you want when two colors need to trade places — flipping a two-tone logo's colors, inverting a checkerboard pattern, or exchanging a foreground/background pair without doing two separate replace passes (which would just turn everything into a single color on the second pass).

Swap vs replace — which do you need?

Use the swapper when both colors should change into each other. Use a one-directional replacer — see the PNG Color Replacer — when only one color should change and everything else, including the "target" color if it's already present elsewhere in the image, should stay exactly as it is.

Tolerance and overlapping colors

Real images rarely use one perfectly uniform color — Tolerance widens each match from an exact hex value to a small cluster of nearby shades, so anti-aliased or slightly-gradient source colors get caught fully. If your two chosen colors are close enough to each other that a pixel could plausibly match both, the tool resolves the conflict by committing that pixel to whichever color it's actually closer to, so nothing gets double-swapped or flickers between the two.

Preserving shades and previewing matches

With Preserve Color Shades on, each matched pixel keeps its original lightness and only its hue shifts to the swap partner's color, so gradients and shading in both colors carry over. Turn on Preview Matches before swapping to see exactly which pixels belong to each color, highlighted over the original image — useful for dialing in tolerance before committing.

Frequently asked questions

How do I swap two colors in an image?

Upload your PNG, then pick both colors using the two swatches. Every pixel matching the first color becomes the second, and every pixel matching the second becomes the first — both directions happen in a single pass. Adjust Tolerance to catch nearby shades, then download the result.

What's the difference between a color swapper and a color replacer?

A replacer is one-directional: color A becomes color B, and B is left alone. A swapper is two-directional: A becomes B and B becomes A at the same time, in one pass. Use the swapper when you want to exchange two colors with each other; use the one-directional PNG Color Replacer when only one color should change.

What happens if my two colors are very similar?

If a pixel is within tolerance of both colors at once, the tool commits it to whichever color is closer before swapping, so every pixel ends up on exactly one side — there's no double-blending or flicker between the two.

What does Preserve Color Shades do?

When on, each matched pixel keeps its original lightness and only its hue changes to the swap partner's color — so shading and gradients in both original colors carry over into their new colors. When off, matched pixels become a flat, uniform fill.

Is my image uploaded anywhere?

No. The color swap is rendered locally with the canvas API — your image never leaves your browser, and nothing is stored on a server.

Related tools: PNG Color Replacer · Image Fade Effect Generator · Color Shades Generator