FLXCode PNG to SVG Converter

FLXCode apps

Appearance

PNG to SVG Converter

Trace a PNG into an SVG you can scale to any size. Best for logos, icons and flat artwork. Your picture stays on your device.

or drop it here, or paste with Ctrl+V

PNG, JPG, WebP, GIF, BMP or AVIF. It never leaves this device.

Tracing turns areas of one color into shapes. It is not a real vector drawing of a photo. Logos and flat art with few colors work best, and photos become a posterized look.

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

Quick start

  1. Choose a PNG, drop it on the page, or paste it with Ctrl+V.
  2. Keep "Logo, flat colors". Set Colors to the number of colors in your logo, white background included.
  3. Look at the traced preview on the right. Raise Detail if corners look rough, lower it if you see crumbs.
  4. Press Download SVG, or Copy SVG code to paste it into an editor or a web page.

What you get from a PNG

A PNG is a grid of colored pixels. An SVG is a list of shapes with a fill color. Tracing walks along the borders between color areas in your PNG and writes each border as a path. The result has no pixels, so it stays sharp at 16 px and at 16 feet.

It works well when the PNG has a few flat colors with clean edges: a logo, an icon, a stamp, a signature, a diagram. Transparent areas stay transparent. It works badly on photos, because a photo has no flat areas to turn into shapes.

Worked examples

These pictures are made in code with known shapes, and traced by the same engine as the tool above, when this page was built. The numbers are what the tool gives you.

A flag of three 32 px stripes (96 x 64 px) and a badge (80 x 80 px: a blue disc with a white disc inside it, and an orange square). Same pictures, three presets:

PresetFlagBadge
Logo, flat colors3 colors, 3 shapes, 322 bytes3 colors, 4 shapes, 802 bytes
Illustration3 colors, 3 shapes, 322 bytes3 colors, 4 shapes, 802 bytes
Photo-ish3 colors, 3 shapes, 322 bytes3 colors, 4 shapes, 810 bytes

Count the badge by hand: the white background, the white disc inside the blue one, the blue ring and the orange square make 4 shapes. The background has two holes (the blue disc and the orange square) and the blue ring has one (the inner disc), so 3 holes. Clean flat pictures trace to the same result in every preset, because there is nothing to merge or smooth.

  • Flag, 322 bytes
  • Badge, 802 bytes

The whole SVG of the flag, 322 bytes:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 64"><path fill="#1d5fc2" stroke="#1d5fc2" stroke-width="0.5" d="M0 0L32 0L32 64L0 64Z"/><path fill="#c81e1e" stroke="#c81e1e" stroke-width="0.5" d="M64 0L96 0L96 64L64 64Z"/><path fill="#ffffff" stroke="#ffffff" stroke-width="0.5" d="M32 0L64 0L64 64L32 64Z"/></svg>

Each stripe is a path. The M, L and Z letters mean move, line and close, so "M0 0L32 0L32 64L0 64Z" is the 32 x 64 blue rectangle. Transparency works the same way: a red 10 x 10 square on a transparent 30 x 20 picture gives 1 color and one path, M10 5L20 5L20 15L10 15Z, and no shape for the empty part.

How a PNG is traced

First the tool picks the colors. It counts the colors in your picture, keeps the most common ones, and skips any color that is too close to one it already has. Then every pixel is moved to its nearest chosen color, and each color is replaced by the average of the pixels it took. Pixels that are mostly see-through are treated as transparent and left out.

Next it finds the outline of every color area, including the holes inside. Straight runs become lines and gentle bends become curves. Each color is written as one path with the holes cut out, in the order the colors were found. The path gets a thin stroke in its own color so that two neighbors do not leave a hairline gap between them.

Numbers this uses

  • Trace size: the longer side is capped at 1000 px. A bigger PNG is scaled down first (limit set for phone memory).
  • Transparency: alpha below 128 of 255 counts as empty, 128 or more as solid. Soft edges become hard.
  • Color merging: two colors whose red, green and blue differences add up to less than 64 (largest scale 765) are tried as one; the limit relaxes to 20 only when you ask for more colors than that leaves.
  • Gap cover: each shape has a 0.5 px stroke in its own color, so neighbors overlap by about 0.25 px.
  • Detail 1 to 5 sets the smallest speck kept (48, 24, 10, 4, 2 edge points), the curve error allowed (3, 2, 1, 0.5, 0.25 px) and the decimals written (1, 1, 1, 2, 2).
  • Color limit: 64 at most. If 98% of the pixels are within 24 of a chosen color, those colors are kept exactly. Otherwise regrouping runs 3 rounds that average them.
  • Tracer: imagetracerjs 1.2.6 by András Jankovics, public domain (Unlicense). We use its color grouping and shape finding and write the SVG ourselves.

Privacy

The picture is traced in your browser and is not uploaded or stored. The tool counts events without cookies, such as "SVG saved", and never a file name, size or setting (details). Licences: Open source used on this site.

FAQ

How do I convert a PNG to SVG?

Choose the PNG, keep the Logo preset, and set Colors to the number of colors in the picture. Check the preview, then press Download SVG. The tool traces the colored areas into paths in your browser, so there is no upload and no waiting for a server.

Will the SVG look exactly like my PNG?

Close for a logo, not exact. Edges are rebuilt as lines and curves, so tiny corner details can round off. Gradients and shadows turn into a few flat bands. If the PNG is a photo, expect a posterized look, not a sharp copy.

Why does my logo come out with extra blobs or colors?

You asked for more colors than the logo has. The tool then splits an edge shade into its own color and traces it as specks. Set Colors to the real count, white background included. A logo with a red mark on white is 2.

Does it keep the transparent background?

Yes. Pixels that are mostly see-through are left out of the SVG, so the background stays empty. A pixel that is only half see-through can go either way, because the cutoff is half. Soft shadows become hard-edged.

Can I use the SVG for a Cricut or a cutting machine?

It works if you keep the colors low. Set Colors to 2 for a one-color cut file, then drop the white background layer in your cutting software. Each color is one path, so a cutter sees one layer per color.

Why is my SVG bigger than the PNG?

A busy picture needs many paths. A logo with 3 colors is usually a few hundred bytes to a few KB. A detailed picture at 64 colors can pass a megabyte. Lower Colors and Detail to shrink it. The stats line under the preview shows the size.

Is the SVG safe to put on a website or open in Figma or Inkscape?

It is plain shapes with fill colors, a viewBox, and nothing else. No script, no outside links, no embedded picture. Figma, Illustrator and Inkscape open it, and it works in an img tag or inline in HTML.

Is my PNG uploaded anywhere?

No. The picture is read and traced on your device. It is not sent, saved or put in the address bar. Only a fixed word such as "png" is counted when you open a file.

More from FLXCode

Share PNG to SVG Converter