Why an SVG turns into a PNG with a white box, how to find and remove the background in the markup, and how to check the PNG is really transparent.

You convert an icon or a logo from SVG to PNG, drop it on a dark slide, and there's a white box around it. The PNG format supports transparency, so the box came from somewhere else: almost always from the SVG itself. This guide shows where it hides, how to remove it, and how to check the result before you use it.
PNG keeps whatever the SVG leaves empty as transparent. If the PNG has a solid background, the SVG drew one. The usual suspects:
A full-size <rect>. Figma, Illustrator and many icon tools export a rectangle the size of the artboard, filled with white. It's usually the first element inside <svg>:
<rect width="100%" height="100%" fill="#ffffff"/>
Delete that line. If the width and height match the viewBox (for example width="512" height="512" on a 0 0 512 512 drawing), it's the background too.
A style on the <svg> element. Look for style="background: white" or background-color on the root element. Remove it.
A clip path or mask with a fill. Less common, but some exports wrap everything in a group whose first child is a filled shape. If deleting the <rect> didn't help, look at the first child of the outermost <g>.
You picked JPG. JPG has no transparency at all, so every converter fills the empty area, usually with white. If you need a transparent image, it has to be PNG. When a white background is what you want, see when to use JPG instead of PNG.
A white background is invisible on a white page, so "it looks fine" proves nothing. Before you ship the PNG:
Transparency is only half of a good logo PNG; the other half is size. The size you choose is the longest edge, and the aspect ratio comes from your SVG, so a 2:1 banner at 1000 px comes out 1000×500.
| Use | Size |
|---|---|
| Small UI icon, chat emoji | 500 px |
| README, docs, blog images | 1000 px |
| Slides, social posts | 1500 px |
| Retina hero images, anything you might crop | 2000 px |
When in doubt, go bigger. Scaling a large PNG down looks fine; scaling a small one up looks blurry.
viewBox. Without it, the drawing can come out clipped or at the wrong proportions. viewBox="0 0 24 24" is typical for icons.This icon has no background, so it converts to a transparent PNG as it is. Paste it, pick 1000 px and put the result on a dark slide:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#7c3aed" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="16 18 22 12 16 6"/>
<polyline points="8 6 2 12 8 18"/>
</svg>
Add <rect width="24" height="24" fill="#fff"/> as the first line inside <svg> and convert again, and you'll see the white box this guide is about.
For hundreds of files in a build step, a CLI is the better fit: rsvg-convert -w 1000 icon.svg -o icon.png (librsvg) or Inkscape's --export-type=png. Both keep transparency as long as the SVG has no background shape.
Why does my PNG have a white background?
Your SVG almost certainly draws one, usually a full-size <rect> near the top of the markup. Delete it and convert again.
Can a JPG be transparent? No. JPG has no transparency, so the empty area is always filled. Use PNG for logos and icons that sit on colored backgrounds.
How do I know the PNG is transparent? Put it on a dark background. A viewer's checkerboard, or a white page, can hide a white box.
What's the largest PNG I can export?
2000 px on the longest edge in the SVG code to PNG converter. For anything larger, use rsvg-convert or Inkscape.
Paste code, pick a theme, and export a PNG in 16:9, 1:1, 4:5, or 9:16.
Create a code image