BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

SVG: Vector images for the web, explained

SVG is a text-based vector image format: shapes drawn from code that stay sharp at any size. Use it for logos, icons and diagrams, not for photos.

Monthly searches · svg
246.0k
Keyword research data
svg
SVG: Vector images for the web, explained
Click the image to view it full size

SVG (Scalable Vector Graphics) is an image format that describes a picture as shapes rather than pixels. An SVG file is a text file in XML: it says "draw a circle here, a line there, fill this area blue", and the browser draws the result at whatever size it's displayed. A PNG of the same logo is a fixed grid of pixels that blurs when it's enlarged; the SVG is simply redrawn.

Here is a complete SVG image, a single diagonal line in a 100-by-100 box:

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <line x1="0" y1="80" x2="100" y2="20" stroke="black" />
</svg>

SVG is a W3C standard. Version 1.1 (Second Edition, 2011) is the latest finished Recommendation; SVG 2 is still a Candidate Recommendation, with its most recent snapshot published on October 6, 2026. All current browsers display SVG. MDN

When to use SVG, and when not to

SVG is the right choice for images that can be drawn from shapes:

  • logos and icons;
  • diagrams, charts and maps;
  • illustrations with flat colors;
  • interface elements that need to scale or change color with CSS.

It's the wrong choice for photos. A photo is millions of slightly different pixels, and describing it as shapes makes a huge file. Use JPEG, WebP or AVIF for photos, and see image compression for keeping them small.

Because SVG is text, it compresses well when your server applies Gzip or Brotli. Files exported from design tools, though, can carry editor metadata and needless detail, so run them through an optimizer before you publish.

How to put SVG on a page

There are three common ways, and they behave differently:

Method Example What to know
As an image <img src="logo.svg" alt="Acme"> or a CSS background Cached like any image; scripts inside the SVG don't run
Inline <svg>...</svg> directly in the HTML Can be styled and animated with the page's CSS and JavaScript; no extra request, but not cached separately
Embedded document <object>, <iframe> or <embed> Runs as its own document, scripts included

Serve SVG files with the content type image/svg+xml and the .svg extension.

Security: treat SVG files as code

An SVG file can contain JavaScript and links to other resources. When you show it through <img> or CSS, browsers disable scripts and block external resources, so it behaves like a plain picture. Those limits don't apply when someone opens the file directly or when it's embedded with <object>, <iframe> or <embed>. MDN

So if your site accepts SVG uploads from users, treat them like code: sanitize them, or serve them only as images, ideally from a separate domain.

SVG and SEO

Google indexes SVG. It lists SVG among the image formats it supports in <img> tags and in Google Images, and it can index .svg files themselves. Google Search Central

Give SVG images a text alternative, as you would any image:

  • For <img src="chart.svg">, use the alt attribute.
  • For inline <svg>, add a <title> element and point to it with aria-labelledby, the pattern Google's image guide shows:
<svg aria-labelledby="chart-title" role="img">
  <title id="chart-title">Monthly visits rose from 2,000 to 5,000 in 2026</title>
  ...
</svg>

Purely decorative SVGs, like a divider line, need no description; hide them from screen readers with aria-hidden="true". Good text alternatives help both accessibility and image SEO.

One exception to watch: favicons. Many browsers accept SVG favicons, but the formats Google lists for favicons in search results are BMP, GIF, ICO, PNG, JPEG, PPM and TIFF. If your main favicon is an SVG, also link a PNG or ICO version so Google has one it can use.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.