Color Invert (Complementary) Tool

Find the exact color inverse by subtracting from white

Invert any color to its exact RGB complement by subtracting each channel from 255. Enter a hex or RGB color and get the inverted hex and rgb() value with a side-by-side preview of both swatches. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is the inverted color calculated?

Each RGB channel is subtracted from 255, so red 52 becomes 203, green 152 becomes 103, and blue 219 becomes 36. This is the exact mathematical inverse, the same operation as a photographic negative.

Get the exact inverse of any color

This tool computes the precise inverse of a color by subtracting each RGB channel from 255 — the same operation as a photographic negative. It is useful for generating dark-mode counterparts, finding a high-contrast accent, or simply seeing what the “opposite” of a color looks like.

How it works

A color in RGB is three numbers from 0 to 255 for red, green, and blue. The inverse is found channel by channel with a single subtraction:

inverse_R = 255 - R
inverse_G = 255 - G
inverse_B = 255 - B

So rgb(52, 152, 219) becomes rgb(203, 103, 36). White (255,255,255) inverts to black (0,0,0) and vice versa, and a fully saturated red #ff0000 inverts to cyan #00ffff.

This is the literal numeric inverse, sometimes called the complementary color. Note that it differs from a hue-rotation complement: subtracting from 255 flips each channel independently, which can shift lightness as well as hue. The tool shows the original and inverted swatches side by side so you can judge the contrast at a glance.

How inverting pairs work out in practice

OriginalInverseNotes
White #ffffffBlack #000000Maximum contrast pair
Red #ff0000Cyan #00ffffPrimary / secondary complement
Green #00ff00Magenta #ff00ffPrimary / secondary complement
Blue #0000ffYellow #ffff00Primary / secondary complement
Mid-gray #808080Near-gray #7f7f7fAlmost identical — poor contrast
Navy #3498dbOrange-brown #cb6724A commonly used accent pair

Pure primary colors always invert to their secondary complement and vice versa, which is why the RGB inverse is so useful for finding natural-feeling contrast pairs. Gray is the notable exception — any gray near the midpoint of the 0–255 range inverts to something nearly identical, making it unsuitable as an inversion-based contrast.

Practical uses

Dark-mode generation: Take a light-background design color and invert it to see a rough dark-mode version. This is a starting point — in practice you may want to adjust lightness further — but it is faster than guessing.

Accent discovery: If your brand color is a cool blue, its inverse is a warm orange. That orange is often a natural high-contrast accent choice that feels harmonious precisely because it sits opposite on the spectrum.

Image editing and CSS filters: The CSS filter: invert(1) property applies exactly this channel subtraction to images and elements. Understanding the math helps predict what invert(1) will do to your UI components.

Double inversion: Inverting twice always returns the exact original, because (255 − (255 − x)) = x. This makes inversion a lossless, reversible operation.

Note on mid-gray

Colors near mid-gray (128,128,128) invert to something very close to themselves. This is useful to know if you are relying on inversion for accessibility — gray-on-near-gray has poor contrast. Start from a saturated, non-gray color for the most useful inversions.