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

# Place an SVG Filter Offset With Signed dx and dy

> Use negative dx or dy to move an SVG filter input left or up. Compare offset-only and merged output, then check the filter region when the shifted edge clips.

Source: https://perfectvector.com/blog/svg-feoffset-dx-dy

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

In a standard, untransformed SVG, negative `dx` moves the input to `feOffset` left and negative `dy` moves it up. Positive values move it right and down. So `dx="-18" dy="12"` shifts the rendered input 18 units left and 12 down. As the only primitive in a filter, `feOffset` shows the shifted version. To see both positions, merge the shifted version with `SourceGraphic`. [Filter Effects Level 1 specifies the offset vector](https://www.w3.org/TR/filter-effects-1/#feOffsetElement).

If the whole shape moved when you expected a shadow behind it, start with the merge. If a shifted edge ends in a straight cutoff, check the filter region before changing the offset.

## Pick the signs and check the units

`dx` and `dy` measure the shift along the filter's local x and y axes. The sample below uses `primitiveUnits="userSpaceOnUse"`, so the offsets follow the same user coordinate system as the shape. The [SVG coordinate-system specification](https://www.w3.org/TR/SVG2/coords.html#InitialCoordinateSystem) defines the initial axes, with x increasing to the right and y increasing downward. A transform on the filtered element or an ancestor can rotate, flip or scale that movement on screen. The sample uses matching viewport and `viewBox` dimensions, so one user unit corresponds to one pixel in this render.

The filter region is the rectangle available for the effect. Its `x`, `y`, `width` and `height` use `filterUnits`, a separate setting from `primitiveUnits`. Here both use `userSpaceOnUse`, so you can compare the shape and the region on the same grid. The [SVG 1.1 filter region reference](https://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion) explains the clip and the coordinate settings.

## Compare the original, the offset and the merge

Save this example as `offset.svg` and open it. It starts with the shift-only version. In the final `<g>`, remove `filter` to see the original. Set it to `filter="url(#both)"` to see both positions on the same canvas. Keep the path and the gold mark fixed for all three views.

```xml
<svg xmlns="http://www.w3.org/2000/svg" width="112" height="88"
     viewBox="0 0 112 88">
  <defs>
    <filter id="offset" filterUnits="userSpaceOnUse"
            primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB"
            x="8" y="8" width="96" height="72">
      <feOffset in="SourceGraphic" dx="-18" dy="12"/>
    </filter>
    <filter id="both" filterUnits="userSpaceOnUse"
            primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB"
            x="8" y="8" width="96" height="72">
      <feOffset in="SourceGraphic" dx="-18" dy="12" result="shifted"/>
      <feMerge>
        <feMergeNode in="shifted"/>
        <feMergeNode in="SourceGraphic"/>
      </feMerge>
    </filter>
  </defs>

  <g filter="url(#offset)">
    <path fill="#307c70" d="M32 18H84V32H94V61H52V48H32Z"/>
    <rect x="41" y="26" width="16" height="4" fill="#f2b643"/>
  </g>
</svg>
```

`SourceGraphic` is the rendered input from the element or group receiving the filter. In the second filter, `result="shifted"` gives the shifted output a name. The merge draws its inputs in order, with later entries over earlier ones. Putting `SourceGraphic` last keeps the original in front where the two overlap. [MDN documents how a merge node reads a named result](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feMerge). For an effect that combines two inputs by overlap, see the [SVG `feComposite` guide](https://perfectvector.com/blog/svg-composite-artwork).

![Three SVG renders of the same stepped teal shape show its starting position, a shift to the left and down, and the two positions merged.](https://perfectvector.com/blog/svg-feoffset-dx-dy/workflow-proof.webp)

*The original starts at (32, 18). The offset starts at (14, 30). The merged render keeps the original in front where they overlap.*

We rendered all three variants with resvg 0.47.0 and measured the rectangle of nontransparent pixels. The right and bottom coordinates in this table are exclusive.

| Version     | Left, top | Right, bottom |
| ----------- | --------- | ------------- |
| Original    | (32, 18)  | (94, 61)      |
| Offset only | (14, 30)  | (76, 73)      |
| Merged      | (14, 18)  | (94, 73)      |

At pixel `(80, 20)`, which only the original reaches, alpha was zero in the offset-only render and 255 in the merge. At `(35, 39)`, the shifted gold mark became covered by the original teal shape in the merge. The path and rectangle attributes stayed identical.

## Check the filter region if the shifted edge clips

In the shift-only filter, change `x="8" width="96"` to `x="24" width="80"`. That keeps the right boundary at 104 and moves the left boundary to 24. We repeated the render with those settings. The visible left edge moved from 14 to 24, while the other three bounds stayed fixed. Restore the original region and check that the full left edge returns.

For your own SVG, first confirm the unfiltered artwork is visible. Then estimate where the shifted paint should land. Give the filter region room for both the source and the result, including any blur. If you set `x`, `y`, `width` or `height` on the primitive itself, inspect that smaller working rectangle too. If the cutoff instead aligns with the SVG frame, follow the [filter and viewport clipping checks](https://perfectvector.com/blog/svg-shadow-clipped).

The example checks opaque artwork at one scale in resvg. Open the delivered SVG in its intended viewer or app to confirm the offset and the merge. For ordinary placement of an entire object, use a translation on the element or group. Reach for `feOffset` to shift an input within a filter chain.

## FAQ

### Can dx and dy both be negative in feOffset?

Yes. In a standard SVG with no intervening transforms, negative dx shifts the filter input left and negative dy shifts it up. A zero value keeps that axis unchanged.

### Why did my original shape disappear after I added feOffset?

When feOffset is the final filter primitive, the result is the shifted input alone. Add a final feMerge that reads the shifted result first and SourceGraphic second to place the original on top of the shifted copy.

### Why did a larger offset cut off part of the artwork?

The shifted paint can extend outside the filter region or its primitive's working rectangle. Expand the relevant boundary and render again. If the cutoff aligns with the SVG viewport, also check whether the visible canvas has room for the effect.

## Start with editable artwork

PerfectVector can turn a raster-only mark into editable SVG paths when you need a clean shape before adding an offset. [Vectorize the unshadowed PNG or JPG](https://perfectvector.com/image-to-vector), then check its silhouette and gaps in an editor before applying the filter. With an existing SVG master, work directly on a copy of that file.

## Sources

1. [W3C — Filter Effects Level 1, feOffset](https://www.w3.org/TR/filter-effects-1/#feOffsetElement) — Defines how the offsets move an input and how primitiveUnits sets their coordinates.
2. [W3C — SVG 2 coordinate systems](https://www.w3.org/TR/SVG2/coords.html#InitialCoordinateSystem) — Defines the initial axis orientations.
3. [W3C — SVG 1.1 filter effects region](https://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion) — Describes the filter region, its units and its clipping boundary.
4. [MDN — SVG feMerge](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feMerge) — Explains combining a named filter output with other inputs.

## Explore

- [Read the HTML article](https://perfectvector.com/blog/svg-feoffset-dx-dy)
- [SVG feImage: Fit, Crop, or Stretch a Filter Image](https://perfectvector.com/blog/svg-feimage-aspect-ratio.md)
- [SVG Gaussian Blur: Set Horizontal and Vertical Blur](https://perfectvector.com/blog/svg-gaussian-blur-stddeviation.md)
- [Product facts](https://perfectvector.com/product-facts.md)
- [FAQ](https://perfectvector.com/faq.md)
- [Pricing and credits](https://perfectvector.com/pricing.md)
