SVG or PNG? Picking the right format for each asset
Every project ends up with a folder of images in mixed formats: a logo as a PNG, icons as SVGs, a hero photo as a huge PNG. Some of it is blurry on retina screens and some of it is far heavier than it needs to be. The r
Every project ends up with a folder of images in mixed formats: a logo as a PNG, icons as SVGs, a hero photo as a huge PNG. Some of it is blurry on retina screens and some of it is far heavier than it needs to be.
The rule is simpler than it looks.
The short rule
SVG for anything made of shapes: logos, icons, illustrations, charts, UI graphics. It is a list of paths, so it is sharp at any size, usually small, and you can change colours with CSS.
PNG (or WebP, or JPG) for anything made of pixels: photos, screenshots, detailed textures. Describing a photo as shapes would be huge and still look wrong.
A quick test: if you could draw it with a pen tool in a few minutes, it should be an SVG.
Problem 1: the logo you only have as a PNG
This is the most common one. The brand logo exists only as logo.png, it looks soft on high-density screens, and you cannot recolour it for dark mode.
You can wrap the PNG in an SVG file, but that changes nothing: it is still pixels inside. What you need is the logo drawn again as paths. Our logo to SVG converter does that: upload the PNG, JPG or WebP, and the AI redraws it as vector shapes. It costs 1 credit.
Check the result by opening the file in a text editor. You should see <path> elements, not a single <image> with base64 data.
Problem 2: the white box behind your SVG
You switch the logo to SVG, drop it on a dark section, and a white rectangle appears behind it. PNGs have real transparency, so this catches people out. An SVG has no background setting; the white is a shape in the file, usually a full-size <rect> that a design app or converter added. Delete it and the background is gone.
We covered every cause and fix in why your SVG has a white background.
Getting both formats from one place
In app.svgmaker.io, you can make an asset as an SVG in the chat and ask for a PNG or WebP copy of it in the same conversation, at the size you need. You keep the vector as the master and get the raster for places that only take pixels, such as some social sites and email clients.
A quick checklist
- Logos, icons, illustrations: SVG
- Photos, screenshots: WebP or JPG; PNG when you need lossless quality or transparency
- Raster-only logo: redraw it as a vector, do not wrap it
- White box on an SVG: look for a background
<rect>
For the full comparison, with file size, quality and browser support side by side, read SVG vs PNG.
Use shapes for shapes and pixels for pixels.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.