Contents
  1. The short answer
  2. Choose the right conversion method
  3. Step-by-step conversion
  4. Using the SVG as a favicon
  5. How to verify the result
  6. A note on rights

The short answer

To turn pixel art into SVG, rebuild each pixel, or each run of same-colored pixels, as square vector shapes on a grid that matches the original image. Do not use a smoothing auto-trace if you want the pixel look to survive. Done this way, the SVG looks exactly like the original pixel art at any size, has crisp square edges, and stays small and easy to edit.

A few terms help define the scope. A raster image, such as PNG, GIF or JPEG, stores a fixed grid of colored pixels. A vector image, such as SVG, stores shapes as geometry: rectangles, paths and fills that are redrawn sharply at any size. A path is a vector outline made of connected points. Tracing means software guesses vector outlines from a raster image. Tracing works for photos and sketches, but it usually rounds off the hard stair-step edges that make pixel art look like pixel art.

Choose the right conversion method

  • Exact grid conversion: every art pixel becomes a 1×1 square, and same-colored neighbors are merged into larger shapes. This is the recommended method for pixel logos and pixel favicons because it keeps the artwork faithful.
  • Smoothing trace: software converts the stair-steps into curves. Use this only if you deliberately want a smooth, non-pixel version of the design. That result is a redesign, not a conversion.
  • Manual redraw: you draw the shapes yourself in a vector editor over the pixel grid. This is practical for very small artwork and gives you full control over shape structure and layer names.

Step-by-step conversion

1) Start from a clean source at native resolution. Each pixel in the image file should equal one art pixel. If you only have an enlarged copy, scale it back down to the true grid using nearest-neighbor resampling, which copies pixels without blending them. Avoid JPEG sources where you can. JPEG compression adds off-color noise around edges, and every stray shade would become an extra vector shape.

2) Reduce and confirm the palette. List the colors the artwork is supposed to use, and replace any near-duplicates or stray anti-aliased shades with the intended colors. Anti-aliasing is the soft blending of edge pixels, and true pixel art normally avoids it. A tight palette produces fewer shapes and a cleaner file.

3) Convert on the grid. Use a pixel-to-SVG exporter, a vector editor's pixel-art tracing mode set to keep blocky output, or a small script that writes one square per pixel. Whichever tool you use, check that it is not applying curve smoothing or corner rounding.

4) Set the coordinate system. Make the SVG viewBox match the pixel grid. The viewBox is the attribute that defines the drawing's internal coordinate space. A 16×16 pixel design gets a viewBox of 0 0 16 16, so every art pixel sits on whole-number coordinates. Add shape-rendering="crispEdges" so renderers do not blur the edges between squares.

5) Merge shapes. Combine adjacent squares of the same color into single paths. This removes the hairline seams that can appear between separate squares, shrinks the file, and makes later color edits a one-step change.

6) Clean up. Delete any full-canvas background shape if the logo or favicon should be transparent. Remove editor metadata and unused definitions. If you run an SVG optimizer, check the output afterward and confirm it kept whole-number coordinates and did not merge shapes of different colors.

Here is a minimal example of a 5×5 plus sign. The first version uses one rectangle per bar; the second merges the red shape into a single path.

<svg viewBox="0 0 5 5" shape-rendering="crispEdges">
  <rect x="2" y="0" width="1" height="5" fill="#d62828"/>
  <rect x="0" y="2" width="5" height="1" fill="#d62828"/>
</svg>

<svg viewBox="0 0 5 5" shape-rendering="crispEdges">
  <path fill="#d62828" d="M2 0h1v2h2v1h-2v2h-1v-2h-2v-1h2z"/>
</svg>

A standalone .svg file also needs the standard SVG namespace attribute on the root svg element. Most editors and exporters add it automatically.

Using the SVG as a favicon

Reference the SVG from the page head as an icon with the SVG media type. Keep a raster fallback, such as an ICO or PNG file, for browsers and platforms that do not use SVG favicons. Support differs across browsers and contexts. This guide does not include a current support table, so check up-to-date documentation for the browsers you need to reach.

<link rel="icon" href="favicon.ico" sizes="any">
<link rel="icon" href="favicon.svg" type="image/svg+xml">

Pixel art scales cleanly only by whole-number factors. A 16×16 grid shown at 32×32 turns each art pixel into exactly 2×2 screen pixels. At sizes that are not whole multiples of the grid, some art pixels render wider than others even though the SVG is perfectly sharp. If the icon will mostly appear at specific sizes, pick a grid that divides evenly into them.

How to verify the result

  • Zoom in far: edges should stay perfectly square, with no rounded corners or wobbly diagonals.
  • Look for seams: thin light lines between neighboring shapes mean the shapes still need merging or crisp-edge rendering.
  • Compare with the original: overlay or place the two side by side, and confirm every pixel's position and color match.
  • Check the colors: the file should contain only the intended palette values, with no leftover anti-aliased shades.
  • Inspect the code: confirm the file contains only vector elements and no embedded image element. An .svg extension alone does not prove the file is fully vector or editable.
  • Test in context: view the favicon in real browser tabs at small sizes and against both light and dark backgrounds.

A note on rights

Converting a file to SVG does not change who owns the artwork. If the pixel art is someone else's logo or character, converting it does not grant permission to reuse it. Confirm you have the right to use it before you publish the favicon or logo.