SVG CheatSheet with Interactive Editor
The all-in-one free online SVG tool with code examples, interactive WYSIWYG and code editor with live preview, code optimizer, tutorial and much more. Scalable Vector Graphics make websites more awesome, make sure to use them for small images and animations! ๐จ Whether you're designing a game, a website, or just playing with code, this SVG CheatSheet and its live editor will help you draw shapes and pictures using nothing but clean code.
What is an SVG?
SVG stands for Scalable Vector Graphics. It's a way to draw shapes using code, and the cool part is:
- SVGs never get blurry (even if you zoom in 100x!)
- You can animate them โจ
- They're easy to edit and small in file size
- They work great on websites
We use SVG images in lots of places:
- Icons on buttons
- Logos on websites
- Graphs, charts, and maps
- Games and animaitons
Examples
Using SVG as an Image
<img src="star.svg" alt="A star icon" width="100" height="100" />
Inline SVG in HTML
<svg width="100" height="100"> <circle cx="50" cy="50" r="40" fill="orange" /> </svg>
<svg width="200" height="100"> <rect x="10" y="10" width="180" height="80" fill="skyblue" stroke="black" /> </svg>
The latter draws a rectangle that's 180 pixels wide and 80 pixels tall, with a skyblue fill and black border. You can also draw:
Shape | Code | What it Does |
---|---|---|
Circle | <circle cx="50" cy="50" r="30" /> |
A circle with radius 30 pixels |
Line | <line x1="0" y1="0" x2="100" y2="100" /> |
A straight line from top-left to bottom-right |
Polygon | <polygon points="50,5 95,100 5,100" /> |
A triangle polygon |
๐ What's in This CheatSheet?
This SVG CheatSheet is divided into colorful panels that explain different parts:
- Basic Structure: how every SVG starts
- Shapes: rectangles, circles, lines
- Path Commands: for advanced drawings like curves
- Text & Fonts: writing inside your SVG
- Colors & Fills: making things colorful
- Transforms: rotate, move, scale shapes
- Filters: shadows, blur, and effects
- Animation: bring your drawings to life!
- Interactivity: click, hover, and react
- Use & Reuse: make one shape and use it everywhere
- Accessibility: help screen readers understand SVGs
- Embedding: put SVG into HTML or CSS
- Tools & Editors: online programs to help you work faster
โ๏ธ How to use the Interactive Editor?
The Interactive SVG Editor with live code preview is a powerful online tool that combines drawing with live coding. Click the pencil icon assigned to each code example in this cheatsheet to preview it in the "what you see is what you get" editor.
With this editor, you can:
-
๐ฆ Draw shapes like rectangles, circles, lines, and polygons
-
๐๏ธ Sketch freely using a freehand tool
-
โ๏ธ Edit the raw SVG code using a built-in code editor (CodeMirror)
-
๐ See changes reflected live as you draw or edit code
-
๐๏ธ Delete, move, resize, and customize shapes
-
๐ค Share your work via a generated URL
-
๐ง Optimize and clean up your SVG code
The editor consists of three core panels:
- Interactive Drawing Panel where you draw shapes with tools and interact with elements
- Code Editor Panel to or edit raw SVG code with syntax highlighting
๐ ๏ธ Tools & Toolbar Buttons
Located at the top of the left visual panel, the toolbar provides tools to draw and manipulate SVG elements.
Icon | Tool | Description |
---|---|---|
๐ | Select | Move and resize shapes manually |
โ๏ธ | Freehand | Draw freely by dragging the mouse |
โ | Line | Click to create straight lines |
โฌ | Rectangle | Click and drag to draw rectangles |
โญ | Circle | Click and drag to draw circles |
๐ท | Polygon | Click multiple times to add points, then close |
๐ | Point Edit | Edit individual anchor points of shapes |
๐๏ธ | Delete | Click a shape to remove it |
โถ โท | Undo / Redo | Step backward or forward through your changes |
๐จ | Color Picker | Set fill/stroke color of new shapes |
โ | Thickness Picker | Set line thickness (stroke width) |
๐งช How to Use These?
Drawing Shapes
-
Select a drawing tool (e.g. Circle โญ).
- Select color and thickness
-
Click (but don't drag) in the left panel to create sahpes. For a line click the starting and end points.
-
Use the Select ๐ tool to move or resize them.
Editing Points
-
Select ๐ Point Edit mode to adjust corners or endpoints of polygons, lines, etc.
Freehand Sketching
-
Choose โ๏ธ Freehand to draw continuous paths like with a pen.
Code Editing
-
In the right panel, write or edit SVG code.
-
Any valid changes are immediately shown in the drawing and preview panels.
๐งน Extra Features
Feature | What It Does |
---|---|
Optimize | Cleans up the code, removes unnecessary data, reduces file size |
Undo/Redo | Step through your history without losing work |
Erase All | Clears the entire canvas and code editor |
Share SVG | Generates a shareable URL with your SVG code embedded |
Minimize Editor | Collapses the editor to a Windows-style bar at the bottom of the screen |
๐งช Load Ready-Made Examples
You'll also find a list of ready-made SVG demos just above the interactive panel. Click on:
๐ Rocket | ๐ณ Tree | ๐ง Cube | ๐ค Robot ...and many more to load example SVGs or from the cheat sheet.
๐ Linked Editors & Auto-Update
The SVG code editor and drawing panel are linked:
-
If you draw something, the code updates automatically.
-
If you edit the code, the drawing changes instantly.
-
You can even paste your own SVG markup to import content.
SVG Path Example
<path d="M10 10 H 90 V 90 H 10 Z" fill="lightgreen" />
This draws a rectangle using "path commands" like M (move), H (horizontal), V (vertical), and Z (close).
Useful Tips
- Use viewBox to make SVGs responsive
- Use <defs> to store gradients or filters
- You can copy SVG from programs like Figma, Illustrator, or Inkscape
- Use the code optimizer in the interactive editor to shrink and clean your files before publishing
๐ Start Creating!
This cheat sheet is here to help you learn by doing. Click around, load the demos in the interactive editor, use the panels, test shapes, and build your own SVG art or animation.