Keep SVG arrowheads the same size

Change the shaft thickness while keeping a shared arrowhead at 16 units.

Asset preparation1 min read

You thicken one connector in an SVG diagram from 2 to 4 units. Its arrowhead doubles in size even though both lines reference the same marker. Check which units the marker uses.

Compare marks at two stroke widths

Open the editable SVG example. The orange arrows use markerUnits="strokeWidth", the default. With markerWidth="8", a 2-unit stroke yields a marker viewport 16 units wide. A 4-unit stroke makes it 32 units wide. The triangle fills the viewport horizontally, so its width doubles too. SVG 2 marker units.

Give the shared marker a fixed size

The mint arrows use userSpaceOnUse. Their marker viewport is 16 × 16 in the referencing path’s coordinates, and the triangle occupies that whole width.

svg
<marker id="head" markerUnits="userSpaceOnUse"
        markerWidth="16" markerHeight="16" viewBox="0 0 16 16"
        refX="15" refY="8" orient="auto">
  <path d="M0 0L16 8 0 16Z" fill="#276855"/>
</marker>

Apply marker-end="url(#head)" to both paths. Check that each triangle is 16 units wide and that its tip follows the path direction. Recheck the smallest export: a thick shaft can still overpower a fixed head. An outer SVG scale or a transform on a path can still change its rendered size.

Image tools
All guides
Keep SVG arrowheads the same size | Formatry Media — Formatry