> [Site index](https://perfectvector.com/llms.txt) — available pages and descriptions.

# SVG Fill Opacity vs. Opacity on Overlapping Shapes

> See why two semitransparent SVG shapes darken where they overlap. Choose fill opacity, object opacity, or group opacity with a tested example.

Source: https://perfectvector.com/blog/svg-fill-opacity-vs-opacity

Language: en
Author: Irene Kim
Published: 2026-11-25T08:00:00+09:00

In SVG, **`fill-opacity` fades the interior paint** and lets you keep a solid outline. **`opacity` fades the element as a whole**, including its fill and stroke. To fade a stack of shapes together, put `opacity` on their shared `<g>`. The renderer combines the shapes first, then applies the fade to that combined result. [SVG 2 rendering and object opacity](https://www.w3.org/TR/SVG2/render.html#ObjectAndGroupOpacityProperties)

The difference shows up when two pieces overlap. Two circles each set to half opacity make a denser overlap. Two opaque circles inside one group at half opacity produce a uniform silhouette if the circles share the same color.

## Which SVG opacity property should you use?

**Fill opacity** controls the opacity of the paint inside a shape. The stroke has a separate `stroke-opacity` setting. Apply element `opacity` when the border and interior should fade together. Apply group `opacity` for a fade that treats a multi-piece icon as a unit. [SVG 2 fill and stroke paint properties](https://www.w3.org/TR/SVG2/painting.html#FillOpacity)

| What you want                     | Set this                         | What to look for                                                            |
| --------------------------------- | -------------------------------- | --------------------------------------------------------------------------- |
| Light interior and solid border   | `fill-opacity=".5"` on the shape | The background shows through the fill, while an opaque stroke stays strong. |
| One shape that fades as a unit    | `opacity=".5"` on the shape      | Both the fill and the stroke fade.                                          |
| Two shapes with a darker overlap  | `opacity=".5"` on each shape     | The overlap receives two layers of paint.                                   |
| One silhouette at uniform opacity | `opacity=".5"` on a parent group | The already-rendered group receives one fade.                               |

## Render three versions of the same pair of circles

Save this as `opacity.svg` and open it on a light background. The left pair uses fill opacity. The middle pair uses opacity on each circle. The right pair uses a single opacity setting on their parent.

```svg
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="74" viewBox="0 0 300 74">
  <g fill="#086c75" fill-opacity=".5">
    <circle cx="28" cy="36" r="22"/>
    <circle cx="56" cy="36" r="22"/>
  </g>
  <g fill="#086c75" transform="translate(100 0)">
    <circle cx="28" cy="36" r="22" opacity=".5"/>
    <circle cx="56" cy="36" r="22" opacity=".5"/>
  </g>
  <g fill="#086c75" opacity=".5" transform="translate(200 0)">
    <circle cx="28" cy="36" r="22"/>
    <circle cx="56" cy="36" r="22"/>
  </g>
</svg>
```

![Three pairs of SVG circles showing denser overlaps with fill or object opacity and a uniform silhouette with group opacity](https://perfectvector.com/blog/svg-fill-opacity-vs-opacity/workflow-proof.webp)

*The original SVG example rendered over white. Each circle is the same size and color. Only the scope of the opacity changes.*

In our 300 × 74 pixel transparent render, the center alpha of the first two pairs was approximately **75%**, compared with **50%** in the group-opacity overlap. **Alpha** measures how opaque a pixel is. In the first two pairs, the source-over formula for the overlap is `0.5 + 0.5 × (1 − 0.5) = 0.75`. In the third pair, the opaque circles are combined before the group gets its single half-opacity fade. [W3C simple alpha compositing](https://www.w3.org/TR/compositing-1/#simplealphacompositing)

The left and middle examples look alike because the circles have no stroke. Add `stroke="#173340" stroke-width="4"` to the first circle in each pair. On the left, the first circle's uncovered stroke stays solid. In the middle, the first circle's stroke fades with the fill.

## Fix an overlap that darkens unexpectedly

First check whether `fill-opacity` is set on a parent group. The property is inherited. Putting `fill-opacity=".5"` on a group passes the setting to the child fills, which can still overlap as separate layers.

If you need one uniform fade, remove the per-child fade and set `opacity=".5"` on the group. Test the output over the actual background, because the composite color will depend on that background. If the SVG looks different only after export or import, the [SVG color export troubleshooting guide](https://perfectvector.com/blog/why-svg-colors-change-after-export) shows how to separate opacity from color profile and paint-reference issues. For an outline that gets buried under a fill, inspect [SVG paint order](https://perfectvector.com/blog/svg-paint-order).

Group opacity changes the rendered paint. It does not merge paths. Keep the group for editability or use a geometry operation if the deliverable needs one actual outline.

## FAQ

### Does fill-opacity affect an SVG stroke?

No. It affects the fill paint. Use stroke-opacity for a separate stroke fade, or opacity on the shape to fade both.

### Why is the overlap between two 50% opacity shapes darker?

Each shape is drawn over the pixels already underneath it. With two same-color layers at 50% opacity, the overlap reaches 75% alpha in the simple source-over case.

### Can I set fill-opacity on a group?

Yes. Its descendants can inherit that fill opacity. Use opacity on the group when you want to render the group as a whole and fade the result once.

## Start with separate editable shapes

PerfectVector can turn flat raster artwork into editable vector paths.

If all you have is a PNG or JPG, [trace the artwork into editable paths](https://perfectvector.com/image-to-vector) and inspect the shapes that should overlap. Set their SVG opacity after you confirm which regions should stay distinct.

## Sources

1. [W3C SVG 2 — Object and group opacity](https://www.w3.org/TR/SVG2/render.html#ObjectAndGroupOpacityProperties) — Explains the compositing scope of element and group opacity.
2. [W3C SVG 2 — Fill paint opacity](https://www.w3.org/TR/SVG2/painting.html#FillOpacity) — Defines the fill painting operation and inheritance.
3. [W3C Compositing and Blending — Simple alpha compositing](https://www.w3.org/TR/compositing-1/#simplealphacompositing) — Defines the source-over calculation used in the overlap example.

## Explore

- [Read the HTML article](https://perfectvector.com/blog/svg-fill-opacity-vs-opacity)
- [SVG Radial Gradients: Move a Highlight with fx and fy](https://perfectvector.com/blog/svg-radial-gradient-focus.md)
- [SVG feMorphology: Add an Outline Without New Paths](https://perfectvector.com/blog/svg-femorphology-outline.md)
- [Product facts](https://perfectvector.com/product-facts.md)
- [FAQ](https://perfectvector.com/faq.md)
- [Pricing and credits](https://perfectvector.com/pricing.md)
