Lunchbox Hands

SVG Color Changer

Find every color in an SVG and change it with a color picker

Drop in an SVG and the tool lists every color it uses: fill and stroke attributes, inline styles, CSS classes in a <style> block, and gradient stops. Click a swatch to choose a new color and every shape that used it changes together. Only the color values are rewritten, so the rest of the file stays exactly as it was, and nothing is uploaded. For the background on how SVG colors work, read how to change SVG colors.

Drop an SVG here or click to chooseOr focus this box and paste SVG code. The file stays in your browser.

Where an SVG keeps its colors

The same red can be written into an SVG in several places, and editing the wrong one is why a color change sometimes seems to do nothing. The tool reads all of these:

WhereLooks likeTypical source
Presentation attribute<path fill="#ed1c24">Figma, Sketch, icon libraries
Inline stylestyle="fill:#ed1c24;stroke:none"Inkscape
Style block rule.cls-1 { fill: #ed1c24; }Adobe Illustrator
Gradient stop<stop stop-color="#ed1c24">Any gradient
Filter colorsflood-color, lighting-colorDrop shadows, glows
Nothing at all<path d="…">Font Awesome and other single-color icons (renders black)

When more than one of these applies to the same shape, CSS wins: a style block rule or inline style overrides a fill attribute. Colors can be written as hex (#f00, #ff0000, #ff000080), rgb() and rgba(), hsl() and hsla(), or any of the 148 CSS color names. The tool treats #F00, red and rgb(255 0 0) as one color, and writes each replacement back in the notation the file already used. The last two digits of #ff000080 are the alpha; 8-digit hex colors: CSS vs Android explains how they map to a percentage.

The color picker

  • Color area and sliders. Drag in the square to set saturation and brightness, and use the hue and opacity sliders below it. Everything works with the keyboard: arrow keys move by 1%, Shift with an arrow moves by 10%.
  • Exact values. Type a hex code or switch to RGB or HSL fields.
  • Pick from screen. In Chrome and Edge an eyedropper button picks any color on your screen, such as a brand color from a style guide open in another window.
  • Quick swatches. The other colors in the same SVG and your recently used colors are one click away, which makes it easy to unify two shades.
  • Before and after. The split chip shows the original next to the new color; click the original half to go back.

Changing everything at once

  • Shift hue rotates every color around the color wheel while keeping lightness and saturation, which turns a blue illustration green without losing its shading.
  • Grayscale converts each color to the gray of the same perceived brightness.
  • Invert flips each RGB channel. Flip light/dark keeps the hue and swaps light for dark, which is usually the better start for a dark-mode version.
  • Merge colors folds near-identical shades (a common leftover of exporting from design tools) into the most used one. The button shows how many colors will remain.
  • All to currentColor replaces every color with currentColor, the usual setup for an icon set. Run the result through SVG to React to get a component.

Limits

The tool changes color values written in the file. It cannot recolor the pixels of an embedded PNG or JPEG (<image>), and a filter such as feColorMatrix keeps altering colors after you change them. Colors inside <animate> and <set>, colors from CSS variables defined outside the file, and newer formats such as oklch() and color-mix() are left unchanged. The tool notes each of these when it finds them. For safety, scripts, event handlers and links to external files are removed from the output. Compressed .svgz files need to be unzipped first.

After recoloring, the SVG Optimizer can shrink the file, and SVG to PNG exports it as an image. To convert a single color between formats, use the Color Converter; to check that new text and background colors are readable, use the Contrast Checker.

Frequently asked questions

How do I change the color of an SVG?

Drop the SVG onto the tool. Every color it uses appears as a swatch with a count of how many times it is used. Click a swatch, pick a new color, and every shape that used the old color changes at once. Download the SVG or copy the code when you are done. To change the color by hand instead, edit the fill and stroke values in the file, or the rules in its style block if it has one.

Is my SVG uploaded anywhere?

No. The file is read and rewritten by JavaScript in your browser tab. Nothing is sent to a server and there is no signup. You can check the Network tab of your browser's developer tools: loading and editing an SVG makes no requests.

Why does my icon have no colors to change?

Two common reasons. Some icons use currentColor, which means they take the text color of the page they sit in; the tool says so and lets you preview them in any color. Others draw shapes with no fill at all, which browsers render as black; the tool lists those as default black, and changing that swatch adds a fill to each shape. An SVG that only contains an embedded PNG or JPEG has no vector colors to change.

What is currentColor and when should I use it?

currentColor is a CSS keyword meaning the current text color. An icon whose fill is currentColor turns blue inside a blue link and white inside a dark button, with no extra CSS. It is the usual choice for single-color icon sets. It only works when the SVG is inlined in the HTML or used as a React component; an SVG loaded through an img tag or CSS background cannot see the page's text color and renders black.

Will it change colors defined in CSS classes?

Yes. Files exported from Illustrator, Figma and Inkscape often keep colors in a style block, for example .cls-1 { fill: #ed1c24 }. The tool reads those rules, shows their colors with the other swatches, and rewrites the value inside the rule. The class names and the rest of the CSS are left as they were.

Does it keep transparency?

Yes. A color with transparency, such as rgba(255, 0, 0, 0.5) or #ff000080, is listed as its own swatch. When you pick a new color the opacity stays at 50% unless you move the opacity slider. Separate fill-opacity and opacity attributes are not touched.

Does the rest of the file stay the same?

Yes. Only the color values you change are rewritten. Indentation, attribute order, IDs, comments, the XML declaration and the path data are kept exactly as they were. The one exception is anything removed for safety: scripts, event handler attributes such as onload, javascript: links and references to external files. The tool tells you when it removes something.

What can't it recolor?

Pixels inside embedded raster images, colors produced by filters such as feColorMatrix, colors inside animate or set elements, colors from CSS variables defined outside the file, and colors written in newer CSS formats such as oklch() or color-mix(). The tool shows a note when the SVG contains any of these.

Get an email when new tools ship

Occasional and short: only when something new is added. Just your email, no account.