SVG Basic Shapes

Beginner
8 min read
Updated: Nov 2026
8 topic guides
Shapes hub

Definition

Basic shapes are the SVG elements you draw first: <rect>, <circle>, <ellipse>, <line>, <polygon>, <polyline>, <path>, and <text>.

After the SVG introduction, open Rectangle and Circle, then move through polygons, path, and text.

Beginner path.

Rectangle & circle → ellipse & line → polygon / polyline → path → text.

Syntax

A tiny SVG with a rectangle and a circle:

SVG
<svg viewBox="0 0 240 120" xmlns="http://www.w3.org/2000/svg">
  <rect x="20" y="30" width="90" height="60" rx="8" fill="#2563eb"/>
  <circle cx="175" cy="60" r="35" fill="#16a34a"/>
</svg>

Topics

Guides in the Basic Shapes section (8 tutorials).

Primitive shapes

4 topics

Fast shapes with a few attributes — start here.

TopicDescriptionTutorial
Rectanglerect with x, y, width, height, and rounded corners.Open
Circlecircle with cx, cy, and r.Open
Ellipseellipse with cx, cy, rx, and ry.Open
Lineline from x1,y1 to x2,y2.Open

Polygons, paths & text

4 topics

Multi-point outlines, freeform paths, and labels.

TopicDescriptionTutorial
PolygonClosed shapes from a points list.Open
PolylineOpen polylines from a points list.Open
Pathd commands for curves and complex shapes.Open
Texttext elements for titles and labels.Open

Live Preview

Change the rectangle corner radius and circle radius — the same attributes as the topic pages.

12
32

Blue rounded rect and green circle share one viewBox.

SVG

rx="12" r="32"

How to Learn Basic Shapes

A practical order for this hub:

  1. Read the SVG introduction and set a viewBox.
  2. Draw a filled rect, then a circle.
  3. Try ellipse and line with stroke.
  4. Build a star or arrow with polygon / polyline.
  5. Learn a few path commands (M, L, C, Z).
  6. Label drawings with text, then open Styling & Effects.

Frequently Asked Questions

The core SVG drawing elements: rectangle, circle, ellipse, line, polygon, polyline, path, and text — the building blocks for icons, diagrams, and illustrations.
Start with rectangle and circle. They need only a few attributes. Path is powerful but denser — learn it after the simpler shapes feel natural.
polygon closes back to the first point and can be filled. polyline is an open chain of segments — great for graphs and open outlines.
Strongly recommended. viewBox defines the coordinate system so shapes scale cleanly when the SVG is resized with CSS or width/height.
Yes. Style <text> with font-family, font-size, fill, and other CSS or presentation attributes — covered on the Text topic page.
This page is the index for the Basic Shapes sidebar section. Each topic page has full syntax, live demos, examples, and FAQs.

Start with SVG Rectangle

Open the rectangle guide — attributes, live preview, and examples.

Rectangle →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful