Standard Geometric Primitives in Native SVG

Scalable Vector Graphics (SVG) provides a dedicated set of native geometric primitive elements used to draw vector shapes directly inside the Document Object Model (DOM). These predefined elements—commonly referred to as SVG basic shapes—allow developers and designers to render vector graphics efficiently without writing complex mathematical paths manually. This guide covers each standard geometric primitive available in native SVG, including its primary use case and core attributes.

Rectangle (<rect>)

The <rect> element draws rectangles and squares. It is positioned using the top-left corner coordinates and dimensioned with width and height values.

Circle (<circle>)

The <circle> element renders a circle defined by a central point and a single radius.

Ellipse (<ellipse>)

The <ellipse> element creates an oval shape similar to a circle, but allows distinct horizontal and vertical radii.

Line (<line>)

The <line> element defines a single, straight line segment drawn between two specified coordinate points.

Polyline (<polyline>)

The <polyline> element creates a continuous series of connected straight line segments. Unlike polygons, polylines are typically left open, though they can be filled.

Polygon (<polygon>)

The <polygon> element defines a closed geometric shape made up of straight line segments. SVG automatically closes the shape by connecting the last coordinate pair back to the first coordinate pair.

Path (<path>)

While the basic shapes cover standard geometry, the <path> element serves as the universal primitive in SVG. It can replicate all other primitives and draw complex shapes, including Bézier curves, arcs, and multi-segment outlines using a series of path commands.