Get to know MDN better
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The SVGPathElement.setPathData() method sets the sequence of path segments as the new path data.
An array of path segments. Each path segment is an object with the following properties:
typeA path commands. If options.normalize is true this will be one of the absolute commands: 'M', 'L', 'C' and 'Z'.
valuesAn array or value containing the parameters for the corresponding command.
None (undefined).
Consider the following <path> element, drawing a square:
The code below uses getPathData() method to return the normalized path data as absolute commands. Setting the returned data back to the <path> element using the setPathData() method will result in the different set of path commands in the DOM:
| SVG Paths # __svg__SVGPathData__setPathData |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jun 23, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.