What SVG actually is
SVG stands for Scalable Vector Graphics. Unlike JPEG or PNG — which store color values for every pixel — SVG stores a mathematical description of shapes: "draw a circle at coordinates (50, 50) with radius 30, filled with red." When the browser renders this, it draws the shape at whatever resolution it needs.
An SVG file is XML text. Open any .svg file in a text editor and you'll see markup like this:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="#FF6B6B" />
<text x="50" y="55" text-anchor="middle" font-size="16">Hi</text>
</svg>This is a complete SVG file — a red circle with text. You can paste this directly into HTML and the browser renders it.
Why logos must be SVG
A PNG logo is a grid of pixels at a fixed size — say, 200×60 pixels. Display it at 400×120 and the browser has to scale up: interpolating between pixels produces blurriness. At 4K resolution or on a Retina display, your PNG logo looks fuzzy while everything else is sharp.
An SVG logo renders at whatever pixel density the screen uses — 1x, 2x, 4x — because it's recalculated mathematically for each size. The circle at 50,50 with radius 30 is always perfectly crisp.
Other situations where SVG is mandatory:
- Icons that appear at multiple sizes in a UI
- Charts and data visualizations (D3.js generates SVG)
- Animated graphics (CSS and JavaScript can animate SVG properties)
- Interactive graphics (SVG elements respond to click and hover events)
SVG advantages in web development
Styling with CSS
/* In your stylesheet */
.logo-icon circle {
fill: #FF6B6B;
}
.logo-icon:hover circle {
fill: #4ECDC4;
transition: fill 0.2s;
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
.logo-icon path {
fill: white;
}
}No extra HTTP request (inline SVG)
Paste SVG markup directly into your HTML — no image request, instant render, and the SVG is part of the DOM (styleable and scriptable):
<button class="icon-button">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M5 12l5 5L19 7" stroke="currentColor" fill="none"/>
</svg>
Save
</button>Using stroke="currentColor" makes the SVG inherit the element's CSS color property — the icon color changes automatically for hover states, focus, and dark mode.
File size for simple graphics
A simple logo as SVG: 2–8 KB. The same logo as PNG at retina resolution (@2x): 30–200 KB. For icons and simple graphics, SVG is dramatically smaller.
SVG can be gzip-compressed (SVGZ) for additional savings — typically 60–80% reduction. Web servers serve SVGZ with Content-Encoding: gzip.
When NOT to use SVG
- Photographs. Photos have millions of colors changing gradually — you can't describe a photograph as geometric shapes. JPEG or WebP is always right for photos.
- Complex illustrations with many paths. A highly detailed SVG illustration with thousands of paths can be larger than an equivalent PNG and slower to render. Profile before assuming SVG is smaller.
- Images displayed only at one fixed size. An icon that always appears at 16×16px can be a PNG sprite — the size advantage of SVG disappears at small, fixed sizes.
Exporting SVG correctly
When exporting SVG from Figma, Illustrator, or Inkscape:
- Flatten complex effects. Drop shadows, blurs, and certain gradients don't export cleanly to SVG from all tools — check the output in a browser
- Use "Outline text." Text in SVG requires the font to be available — outline (convert to paths) to avoid font dependency
- Remove hidden layers. Invisible layers still add file size — delete them before export
- Use SVGO. The SVG Optimizer tool removes redundant metadata, precision decimals, and unused elements — typically 30–60% file reduction
Converting SVG to PNG or vice versa
Sometimes you need a raster version of an SVG — for email, older apps, or APIs that don't accept SVG. The free image converter handles SVG-to-PNG conversion at any resolution you specify. For the reverse (PNG to SVG), note that auto-tracing a raster image produces approximate vector paths — it works for simple logos but not for photographs.
For QR codes specifically: download as SVG for print (infinite resolution), PNG for digital display. The QR code generator offers both.
Related tools
- Free Image Converter — convert between SVG, PNG, JPEG, and WebP
- Free QR Code Generator — download QR codes as SVG for print use
Written by Achraf A., founder of TheFreeAITools.