How to Create SVG Graphics: 3 Methods That Work

2026-11-08 · SVG Basics

Three ways to make an SVG: write the markup, draw it in a vector editor, or generate it from a description. What each is good for, step by step, and how to check the file before you use it.

What an SVG actually is

SVG (Scalable Vector Graphics) is a text file that describes a picture with shapes: rectangles, circles, lines and paths, each with a fill and a stroke. Because the file stores geometry instead of pixels, the browser redraws it sharply at any size, from a 16 px favicon to a 3 m banner.

That makes SVG the right master format for anything built from flat shapes: icons, logo marks, simple illustrations, patterns, diagrams and UI decoration. It is the wrong format for photos, which need millions of individually coloured pixels.

There are three practical ways to create one. You can write the markup by hand, draw it in a vector editor, or generate it from a written description. Most designers end up using all three, so here is how each works and when to pick it.

Method 1: Write the SVG by hand

Hand-coding sounds advanced, but simple graphics take a few lines. Open any text editor and save this as badge.svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="28" fill="#1d4ed8"/><path d="M20 33l8 8 16-18" fill="none" stroke="#fff" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/></svg>

That is a blue check badge. The parts to understand:

- viewBox="0 0 64 64" sets the drawing grid. Every coordinate is measured on it, and the graphic scales to whatever size you display it at. - circle, rect and line are basic shapes with readable attributes. - path draws anything else. M moves the pen, L draws a line, C draws a curve and Z closes the shape. - fill colours the inside, stroke draws the outline and stroke-width sets its thickness in grid units.

Hand-coding is best for geometric icons, loaders, charts and anything you want to control from CSS or JavaScript. It gets slow for organic shapes, because nobody wants to type out the curve points of a fox's tail.

Method 2: Draw it in a vector editor

A vector editor gives you a pen tool, shape tools and layers, then writes the SVG for you on export. The steps are the same in any editor.

1. Set up the artboard on a clean grid. Use 24 × 24 or 48 × 48 for icons and a round number such as 512 × 512 for larger art. 2. Build from primitives first. Rectangles, circles and polygons, combined with union and subtract, give cleaner geometry than freehand pen paths. 3. Use the pen tool only for true curves. Place as few points as you can, at the extremes of each curve, with handles kept horizontal or vertical where possible. 4. Keep colours as flat fills. Gradients, blur and drop shadows export as heavy filter code or break in some viewers. 5. Convert text to outlines before export if the graphic will be used where the font is not installed. 6. Export as SVG with "minify" or "optimize" turned on, and without embedded raster images.

This method gives the most control, and it is how most commercial icon sets are made. Its cost is time: a polished 24 px icon often takes 20 to 40 minutes.

Method 3: Generate it from a description

AI generators now write the SVG markup directly from a prompt, which is the fastest way to get from an idea to an editable vector. The quality depends on the prompt more than on the tool, so describe the result rather than the mood.

A useful prompt names four things: the subject ("a paper plane"), the type (icon, logo mark or illustration), the style ("flat, two colours, rounded corners") and any constraint ("no text", "centered", "thick 2 px outlines").

Compare "a cool travel icon" with "a paper plane icon, flat, navy and sky blue, rounded corners, no outline, centered". The second leaves far less to chance, and you will rarely need a second attempt.

VEXURA's generators work this way: the icon generator, illustration generator and SVG generator draw the SVG from your sentence, and you can then ask for changes in plain words ("make the wings lighter"). Starter accounts get 1 free generation a day with PNG and JPEG download; SVG export is part of Pro.

Treat a generated SVG like a first draft from a fast assistant. Check it with the steps below before it goes into a product.

Which method to use

Pick by the job, not by habit.

- A handful of simple geometric shapes, or a graphic you will animate with code: write it by hand. - A brand asset that must match an exact spec, or a large icon family: draw it in an editor. - An idea you want to see quickly, a one-off illustration, or a starting point to refine: generate it, then edit. - A raster logo you need as a vector: trace it instead. The vectorizer converts PNG or JPG into SVG shapes. - Ready-made graphics for a project today: start from a free pack such as free SVG icons or geometric SVG shapes and adjust colours.

Five checks before you use any SVG

Whichever way the file was made, run these checks. They take two minutes and catch most problems.

1. Open the file in a browser at 400% zoom. Edges should be crisp and no shape should be cut off at the viewBox edge. 2. Look at the file size. A typical icon should be under 2 KB and a detailed illustration under 50 KB. Much larger usually means embedded images or a huge number of tiny path points. 3. Read the first lines of code. Delete editor metadata, comments and empty groups. An optimizer such as SVGO does this automatically. 4. Check for fixed width and height attributes. Keep the viewBox, and remove width and height if you want the graphic to scale with its container. 5. Test it small. View icons at 16 px and 24 px. Details that vanish at that size should be simplified or removed.

If you need the same artwork as a PNG for slides, email or social posts, keep the SVG as the master and export PNG copies from it. The image converter does SVG to PNG at any width in your browser.

A simple workflow to repeat

For most projects this order saves the most time: sketch or describe the idea, produce a first version by the fastest method that fits, clean it in an editor, run the five checks, then save the master SVG with a descriptive file name such as icon-paper-plane-24.svg.

Keep one folder of masters and generate every PNG, JPG or WebP copy from it. When the design changes, you edit one file and re-export, instead of hunting for the one PNG that was never updated.

Generate an SVG

More guides on the VEXURA blog