Getting Started• 5 minutes read

Working with SVG Icons

Every detail matters when someone lands on your store. A blurry logo, chunky icons, or graphics that look fine on desktop but soft on mobile can make a site feel less polished.

That is where SVGs can help.

SVGs are often the best choice for logos, icons, badges, and other simple graphics because they stay sharp at any size and are usually very lightweight.

This guide explains how to use them correctly.

What is an SVG?

Most images on the web are either raster or vector.

Raster images are your typical ones like JPEG, PNG, and WebP. They are made of pixels. They work well for photos, but will get blurry if you enlarge them too much.

SVG stands for Scalable Vector Graphics. Instead of pixels, SVGs use instructions that tell the browser how to draw shapes, lines, and colors. Because of that, they stay sharp no matter how large or small you make them.

Why SVGs are useful for Webstores

Here’s a typical example of an SVG:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> <circle cx="50" cy="50" r="40" fill="#e74c3c" /> </svg>

And it creates a dot like this:

PNG Image

I went ahead and even optimized the image above for speed. The end result is a ~1k file.

However, the code above it is just ~100 bytes.

To translate that into something simpler: 1 KB = 1024 bytes: 1 kb = 1024 bytes

This means that the SVG is around 10x smaller! And, you could make the SVG 10x larger and it would still be 100 bytes (you can’t say the same for the PNG).

Of course, the wins here aren’t always ten fold, but it’s smaller size and scalability make it a real winner for simpler elements.

That makes SVGs especially useful for things like:

  • logos
  • cart icons
  • search icons
  • account icons
  • social icons
  • trust badges
  • payment icons

A single SVG logo will stay sharp everywhere.

These add up, and lighter files mean faster page loads..

Since we covered how amazing SVGs can be, let’s get to the “scary part” now.

The Security Risk

SVGs are not just images. They are code-based files. This means they can sometimes contain unsafe code if they come from a bad source.

Because of this, WordPress blocks SVG uploads by default.

BUT, they are unblocked on your site! This means that anyone with admin privileges is allowed to upload them!

So you, who has admin privileges, should never upload them carelessly.

The safest approach is this:

  1. Only use SVGs from sources you actually trust
  2. Sanitize them before upload

Alternatively, and the most beginner friendly option, is letting WordPress deal with it by using a plugin like Safe SVG. It will sanitize them for you. It is easy and convenient.

But what is sanitization?

“Sanitize” means cleaning the file so it contains only safe drawing data and not any risky code:

<svg xmlns="http://www.w3.org/2000/svg">
  <circle cx="50" cy="50" r="40" fill="red" />
  
  <script>
    alert('This could steal session data');
  </script>
</svg>

It is meant to clean up any code that could be considered unsafe.

When not to use SVG

SVG is not the best format for everything.

Do not use SVG for:

  • product photos
  • banners with photographic backgrounds
  • complex artwork with lots of detail
  • images that look like photos

For those, use WebP instead. In some cases JPEG or AVIF can also make sense, but WebP is the easiest general recommendation for most store owners.

A good rule of thumb is this:

  • If it looks flat, simple, and graphic-like, SVG is often a good fit
  • If it looks like a photo, use WebP

SVG vs WebP: the easiest way to decide

If you are unsure which format to use, ask one question:

Does this image behave more like an icon or more like a photo?

Choose SVG for simple brand and interface graphics.
Choose WebP for photos and detailed image-heavy visuals.

If you really are not sure, export both and compare file sizes. Use the one that stays small while still looking good.

Should you optimize SVGs before uploading?

Yes.

Design tools often export SVGs with extra clutter that is not needed on a live website. That can make the file larger than necessary.

A simple tool like SVGOMG can help remove that extra bloat before upload.

For beginners, the workflow can be as simple as this:

  1. Export the SVG from your design tool
  2. Run it through SVGOMG
  3. Upload it to WordPress with a sanitizing plugin active
Same quality, almost half the size

That gives you a file that is smaller. For safety, you should still use a sanitizing plugin.

Inline vs External SVGs

There are technical differences between inline SVGs and SVG files loaded as images, but most beginners do not need to get deep into that.

The practical version is:

  • Inline SVGs are often best for small header icons and other important interface elements
  • External SVG files are usually fine for badges, logos in content, and other non-critical graphics

On your site, you also have an option to inline your SVG images.

Probably the best advice here is to inline very small images (small, as in “less kb”) and everything that comes to view immediately on page load – like the logo – and if it is not immediately visible, use it as an external image.

A Quick Note on Accessibility

You do not need to become an accessibility expert to get the basics right.

Just remember:

  • Give meaningful SVG images alt text when used as images
  • If an icon is only decorative, it should not distract screen readers
  • Treat SVGs the same way you would treat any other important image on your site

If you upload SVGs through the media library, do not skip the alt text field when it matters.

Good Places to Get SVG Icons

If you need icons for your store, try to use one consistent icon set so everything feels visually matched.

A few reliable options are:

Remember: If you download from a lesser-known source, always check the license before using icons on a commercial store. Some are free with attribution, while others allow free commercial use without it.

The Takeaway

SVGs are a great choice for WooCommerce stores – when used in the right places.

Get the basics right and SVGs can help your store look sharper and load lighter without much extra effort.