Skip to content

SVG vs PNG for icons: which should you use on your website?

1 December 2026 ยท 4 min read

You can download every Smash Icons icon in two file types: SVG and PNG. They look the same at first. But they act in very different ways on a page. This guide shows you the difference and when to pick each one.

What the two file types are

SVG is short for Scalable Vector Graphics. An SVG file does not store dots. It stores a list of steps, such as "draw a circle here with a thin line". The browser follows those steps each time it draws the icon. So it can draw the icon at any size.

PNG stores a fixed grid of coloured dots, called pixels. Some of the dots can be clear. A 512 by 512 PNG holds 262,144 pixels. To show it at another size, the browser has to add pixels or throw some away.

Why SVG is often the better choice for icons

It is sharp at every size

The browser draws an SVG fresh each time. So one file looks sharp at 16 pixels in a menu and at 400 pixels on a home page. It looks sharp on every kind of screen. A PNG needs a bigger file to look sharp on a high-density screen, such as a new phone.

The files are small

A simple line icon is often 300 to 800 bytes as an SVG. The same icon as a 512px PNG is a few kilobytes. On a page with lots of icons, that adds up.

You can change it with code

You can paste SVG code right into your HTML. Then you can colour it with CSS. If the icon uses currentColor, it takes the colour of the text around it. This works on hover and in dark mode too. A PNG has fixed colours. To change them, you need a new file.

It can move and it can speak

You can animate each shape in an SVG with CSS. You can also give the file a <title> that screen readers say out loud.

When PNG is the right choice

SVG does not work everywhere. Use the PNG when:

  • The place does not take SVG. This is true of many email apps, some social networks, older office apps and most app store pages.
  • You need a quick picture for a slide, a document or a chat message.
  • The picture has lots of detail. A drawing with thousands of shapes can be bigger as an SVG than as a PNG. This is rare for icons.
  • People upload files to your site. An SVG can hold scripts, so many sites block SVG uploads. Files you download yourself from a site you trust are fine.

How to add an SVG icon to a web page

The simple way is as an image:

<img src="/img/calendar.svg" width="24" height="24" alt="Calendar">

Or paste the code into the page, if you want to style it with CSS:

<button class="btn">
  <svg viewBox="0 0 24 24" width="24" height="24" fill="none"
       stroke="currentColor" stroke-width="1.5" aria-hidden="true">
    <path d="M5 12h14M13 6l6 6-6 6"/>
  </svg>
  Continue
</button>

Always set width and height. This stops the page from jumping as it loads.

How to add a PNG icon

<img src="/img/calendar.png" width="24" height="24" alt="Calendar">

Use a PNG that is two or three times bigger than the size you show it at. Then it stays sharp on high-density screens. A 512px PNG is big enough for any icon shown at 24 to 128 pixels.

A quick look at both

SVG PNG
Sharp at any size Yes Only up to its pixel size
Usual icon file size Under 1 KB 2 to 15 KB
Change colour with CSS Yes, when pasted into the page No
Works in email Rarely Yes
Can be edited in design apps Yes No

The short answer

Use SVG on websites and in apps. Keep the PNG for email, documents, social media and any place that does not take SVG. That is why every icon in the Smash Icons library gives you both.

More from the blog