What an SVG is and why you might make one

An SVG (Scalable Vector Graphic) is an image made from shapes and lines instead of pixels. Unlike a photograph or PNG, an SVG stays sharp at any size — zoom in on a logo and it looks as clean as the original. SVGs are text-based, which means you can edit them in a code editor or a design program, and they're small files that load fast on websites.

You create an SVG when you need a graphic that won't blur when resized: logos, icons, diagrams, maps, or simple illustrations. If you're building a website or need a graphic that works at multiple sizes, SVG is the format to use.

Key Takeaways

  • SVGs are made from shapes and code, not pixels, so they scale perfectly to any size without losing quality.
  • You can create an SVG using free design software like Inkscape, or by writing the code directly in a text editor.
  • Most design programs (Adobe Illustrator, Figma, Affinity Designer) can save files as SVG, even if you drew them with a mouse or stylus.
  • SVG code is readable text, so you can open an SVG file in Notepad and edit the numbers to change colors, sizes, or positions.
  • Start with a design tool if you're new to this; learn to code SVGs later if you need fine control or want to generate them automatically.

Using free design software to draw an SVG

Inkscape is the most common free tool for creating SVGs. Download it from inkscape.org, install it, and open a new document. You'll see a blank canvas and a toolbar on the left with drawing tools: the rectangle tool, circle tool, pen tool (for drawing freehand), and text tool.

Draw your shapes by clicking the tool you want, then clicking and dragging on the canvas. Change colors by right-clicking a shape and selecting "Fill and Stroke". When you're done, go to File > Save As, choose "Scalable Vector Graphic (.svg)" from the dropdown, and pick a filename. Inkscape saves it as an SVG file you can open in a browser or on a website.

If you already use Adobe Illustrator, Figma, or Affinity Designer, you can draw in those programs and save as SVG the same way — File > Export As (or Save As) and choose SVG format. These programs cost money, but Figma has a free tier that includes SVG export.

Converting an existing image to SVG

If you have a PNG, JPG, or other image and want to turn it into an SVG, you need to trace it — convert the pixels into vector shapes. Inkscape has a built-in tracer: open your image in Inkscape, select it, then go to Path > Trace Bitmap. A dialog box appears with settings; the default usually works. Click OK and Inkscape creates an SVG version on top of your image.

Online tools like Potrace (potrace.org) and Vectorizer (vectorizer.io) also trace images to SVG. Upload your image, adjust the settings if needed, and download the SVG. These work well for simple images with clear shapes and solid colors. Photographs and detailed images don't trace cleanly — the result will have too many shapes and look messy.

Writing SVG code by hand

An SVG file is plain text. Open Notepad (or any text editor), type this code, and save the file with a .svg extension:

<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="50" fill="blue" /> </svg>

This creates a blue circle 200 pixels wide and tall. The cx and cy numbers are the center position, r is the radius (size), and fill is the color. Open this file in a web browser and you'll see the circle. Change "blue" to "red" or "green", save, and refresh the browser — the circle changes color instantly.

Common SVG shapes are circle, rectangle, line, polygon (for custom shapes), and path (for curves). A rectangle looks like this: <rect x="10" y="10" width="100" height="50" fill="green" />. The x and y are the top-left corner, width and height are the size. Learning to hand-code SVGs takes practice, but it gives you exact control and is useful if you want to generate graphics from data or automate design changes.

Editing SVG code to change colors and sizes

Because SVGs are text, you can edit them in any text editor. Right-click an SVG file, choose "Open With", and pick Notepad or your text editor. You'll see the code. Find the fill attribute (the color) and change it to a different color name or a hex code like #FF5733. Find the width and height numbers and change the size. Save the file and open it in a browser to see the changes.

This is much faster than reopening a design program if you only need to tweak a color or size. For bigger changes — moving shapes around, adding new elements — a design tool is easier, but hand-editing works for quick fixes.

Saving and using your SVG

Once you've created your SVG, you can use it almost anywhere. Put it on a website by adding this line to your HTML: <img src="myimage.svg" alt="description" />. Use it as a background image in CSS, embed it directly in HTML code, or insert it into a document. SVGs scale perfectly on any device, so a logo looks sharp on a phone and on a desktop monitor.

When you save an SVG from a design program, you may see options like "Optimize SVG" or "Remove metadata". These make the file smaller and faster to load. For most uses, these settings are fine. If you're hand-coding, keep the file simple — fewer shapes and shorter code means a smaller file.

Common mistakes and how to avoid them

The biggest mistake is saving as PNG or JPG instead of SVG. If you draw in Inkscape or Figma and save as PNG, you lose the vector format and get a pixelated image that won't scale cleanly. Always choose SVG format when you save.

Another common issue: tracing a photograph. Photographs have millions of colors and details. When you trace them, Inkscape creates thousands of shapes and the file becomes huge and slow. Tracing works best on simple graphics, logos, and drawings with solid colors. For photos, stick with PNG or JPG.

If you hand-code and the SVG doesn't show up, check that the opening tag includes xmlns="http://www.w3.org/2000/svg" — without this, browsers may not recognize it as an SVG. Also make sure every opening tag has a closing tag or is self-closing (ends with />).

Frequently Asked Questions

Can I edit an SVG in Photoshop?

Photoshop can open SVGs, but it converts them to pixels, which defeats the purpose. Use Illustrator, Inkscape, or Figma instead — these keep the vector format so you can edit shapes and scale without losing quality.

What's the difference between SVG and PNG?

PNG is made of pixels and gets blurry when you enlarge it. SVG is made of shapes and code, so it stays sharp at any size. SVGs are usually smaller files and work better for logos and icons. Use PNG for photographs and detailed images.

Can I use SVG on a website?

Yes. Add it with an img tag, use it as a background image in CSS, or embed the code directly in your HTML. SVGs load fast and scale perfectly on any screen size, making them ideal for responsive web design.

How do I make an SVG transparent?

In a design tool, set the fill to "none" or the opacity to 0. In code, use fill="none" or add opacity="0.5" (0 is invisible, 1 is fully visible). You can also use fill="rgba(255,0,0,0.5)" for a color with transparency.

Is SVG smaller than PNG?

Usually, yes — especially for simple graphics and logos. A complex SVG with many shapes can be larger than a PNG. For icons and flat designs, SVG wins. For photographs, PNG is smaller and better.