Put an SVG text stroke behind the fill

Use paint-order in the SVG code to keep a stroke from covering thin letter details.

Asset preparation2 min read

An outlined letter in an SVG looks thinner when displayed. The stroke is centered on the outline, so its inner half covers part of the letter when the fill is painted first. Change the paint order in the SVG code to preserve the visible letter shape.

Compare the same letter twice

Open the editable SVG sample. The two letters share one path, a light fill and a 12-unit violet stroke. The left uses the normal order: fill, stroke, then markers if present. At the stems, the visible light area narrows.

The right uses paint-order="stroke". The stroke is painted first, then the fill covers the part inside the letter. The width of the stroke and the path geometry stay the same. SVG 2 paint order.

svg
<text x="20" y="80" font-size="72" font-weight="bold"
      fill="#f8f5eb" stroke="#7043c1" stroke-width="8"
      stroke-linejoin="round" paint-order="stroke">SALE</text>

Check the smallest export

Compare both versions at the size the reader will see. Check a thin stem and the opening inside a letter such as A. The fill should keep its original width. The outer outline uses about half the specified stroke width along a straight edge. In a tight opening, the outline can still close the gap. Reduce the stroke and check again if that happens.

Verify in the app or browser that receives the SVG. If an export engine ignores paint-order, paint two identical paths in order: the stroked path first, then the fill-only path. Keep the editable master and verify both copies still align in the delivered file.

Image tools
All guides
Put an SVG text stroke behind the fill | Formatry Media — Formatry