SVG Path Generator
Generate SVG path data for circles, rectangles, triangles, stars, and hearts at any size, using the M, L, C, A, and Z path commands.
SVG Path Generator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: M=moveto, L=lineto, C=curveto, A=arc, Z=close
Worked example โ SVG path data
Formula
M=moveto, L=lineto, C=curveto, A=arc, Z=close
Generate SVG path data for common shapes.
Worked Examples
Example 1: Star shape
Problem:5-pointed star, 100px
Solution:Alternating outer and inner radius points
Result:SVG path data
Frequently Asked Questions
What are SVG path commands?
M=move to, L=line to, C=cubic bezier, Q=quadratic bezier, A=arc, Z=close path. Lowercase = relative coordinates.
What is the difference between absolute and relative path commands?
Uppercase commands (M, L, C) use absolute coordinates from the SVG origin (0,0). Lowercase commands (m, l, c) use coordinates relative to the current pen position. Relative commands make paths easier to move and reuse at different positions.
Where does the generated SVG path data go inside an HTML page?
Paste the path data into an SVG element: <svg viewBox='0 0 100 100'><path d='M ...' fill='blue' /></svg>. Set width and height on the SVG element, and use the viewBox value provided by the generator for correct scaling.
When would I use custom SVG paths?
SVG paths are ideal for scalable icons, logo graphics, custom button shapes, animated illustrations, map overlays, and data visualization elements. Unlike raster images, they scale perfectly to any resolution and can be styled and animated with CSS.
Why does a full circle need two A commands instead of one?
An elliptical arc is defined by its two endpoints, so if the start and end coincide the segment is degenerate and the SVG specification says it is skipped entirely - nothing is drawn. The standard workaround is two semicircular arcs: move to one side of the circle, sweep to the diametrically opposite point with rx and ry both equal to the radius, then sweep back. Because the endpoints are opposite, both candidates are semicircles, so it is the sweep flag rather than the large-arc flag that decides which way the pen travels.
What do the large-arc-flag and sweep-flag in an A command actually select?
Given a start point, an end point and a pair of radii, four different arcs can connect them, so the A command needs two binary flags to disambiguate: A rx ry x-axis-rotation large-arc-flag sweep-flag x y. The large-arc-flag picks the longer (1) or shorter (0) of the two possible sweeps, and the sweep-flag picks the direction of travel, 1 being the positive-angle direction, which looks clockwise because y increases downward in SVG. Flip either flag and the same endpoints produce a visibly different curve.
How does a five-pointed star path place its inner and outer vertices?
A five-pointed star has ten vertices, so consecutive vertices sit 360/10 = 36 degrees apart: outer points every 72 degrees starting at -90 degrees so the first point aims straight up, with an inner vertex offset 36 degrees between each pair. The only free parameter is the ratio of inner to outer radius. This generator uses 0.4; the classical pentagram, whose edges lie on straight lines, uses 1/phi squared with phi the golden ratio, about 0.382. Larger ratios give blunt points, smaller ones give thin spikes.
When should an SVG path use a C cubic curve rather than a Q quadratic curve?
C takes two control points before the endpoint (C x1 y1 x2 y2 x y) while Q takes one (Q x1 y1 x y). The extra control point lets a cubic contain an inflection - an S-bend - inside a single segment, which a quadratic cannot. Any quadratic can be rewritten exactly as a cubic by placing each control point two thirds of the way from its endpoint toward the quadratic's control point, so cubics are strictly more expressive at the cost of two more numbers per segment.
When should I use the S and T shorthand commands?
S and T are smooth continuations. S x2 y2 x y draws a cubic whose first control point is the reflection of the previous segment's second control point about the current point, and T x y does the same for a quadratic. Using them guarantees tangent continuity at the join, so a chain of curves cannot develop an accidental kink when you hand-edit coordinates, and the path data gets shorter. If the preceding command was not a curve of the matching type, the reflected control point falls back to the current point.
How does fill-rule change the way a self-intersecting path is filled?
fill-rule decides which regions count as inside. The default, nonzero, casts a ray from a candidate point, adds one for each crossing in one direction and subtracts one for the other, and fills unless the total is zero. evenodd just counts crossings and fills when the count is odd. The practical consequence is that under nonzero an inner subpath only cuts a hole if it is drawn in the opposite winding direction, whereas under evenodd the drawing direction is irrelevant.
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎCSS Flexbox Generator
css flexbox generator. Get instant, accurate results.
๐งฎBandwidth Time Transfer Calculator
Calculate bandwidth time transfer with inputs, formulas, and instant results.
๐งฎDownload Time Calculator
Calculate download time with inputs, formulas, and instant results.
๐งฎThroughput Efficiency Calculator
Calculate throughput efficiency with inputs, formulas, and instant results.
๐งฎBase64 Encode & Decode Calculator
Calculate base64encode decode with inputs, formulas, and instant results.
๐งฎHash Checksum Calculator
Calculate hash checksum with inputs, formulas, and instant results.
๐งฎUrlpercent Encoding Calculator
Calculate urlpercent encoding with inputs, formulas, and instant results.
๐งฎCron Expression Builder Calculator
Calculate cron expression builder with inputs, formulas, and instant results.