Get to know MDN better
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The SVGPathElement.getPathData() method returns the sequence of path segments that corresponds to the path data, optionally normalizing the values and segment types.
An optional object for controlling aspects of the path data retrieval process. This object may contain the following properties:
normalize OptionalA boolean value indicating whether the returned sequence of path segments is converted to the base set of absolute commands ('M', 'L', 'C' and 'Z'), with the values adjusted accordingly.
An array of path segments corresponding to the path data. If no valid path data exists, returns an empty sequence.
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.
Consider the following <path> element, drawing a square:
The getPathData() method will return an array with the raw path data, the same as it's set in the d attribute. With the normalize: true option set, it will return path data normalized to the base set of path commands:
| SVG Paths # __svg__SVGPathData__getPathData |
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.