Raster vs vector: what is the difference?

A raster image is a grid of coloured pixels: JPG, PNG, WebP, GIF, BMP and phone photos all work this way. Avector image is a list of shapes, such as lines, curves and filled areas, that is drawn fresh at whatever size it is shown; on the web that means SVG.

Use raster for photos and anything with fine texture. Use vector for logos, icons, diagrams and lettering that must stay sharp at every size.

Side by side

FeatureRaster (JPG, PNG, WebP, GIF)Vector (SVG)
Made ofA fixed number of pixels, each with its own colourShape and path instructions with fill colours
EnlargedPixels get bigger: edges go soft or blockyRedrawn at the new size: edges stay crisp
File size depends onPixel count, format and quality settingHow many shapes and points the drawing has
Good atPhotos, scans, textures, soft shadowsLogos, icons, charts, diagrams, line art
Weak atBeing scaled up; one file per sizePhotos and gradient-heavy art; very complex drawings get heavy
EditingPaint over pixels in a photo editorMove, recolour or reshape individual objects
Text insideTurned into pixelsCan stay real, selectable text

The definitions come from MDN, which says raster images “are defined using a grid of pixels” and lists BMP, PNG, JPEG and GIF as popular raster formats, while a vector file “contains shape and path definitions that the computer can use to work out what the image should look like when rendered on the screen.”

Raster: 16 cells, each a colourVector: 4 points and curves
The same round blob stored two ways. The raster version only knows which cells are filled; the vector version knows the outline, so it can be drawn smoothly at any size.

Why size behaves so differently

A raster file grows with its pixel count. Double the width and height and there are four times as many pixels to store. A vector file does not change when you show it bigger, because only the instructions are stored. MDN describes the difference on screen: a zoomed raster image “starts to look blocky”, while the vector one “continues to look nice and crisp”.

The other side of this is that vectors are not small by nature. MDN warns that “SVG can get complicated very quickly, meaning that file sizes can grow; complex SVGs can also take significant processing time in the browser.” A drawing with thousands of tiny shapes can outweigh a compressed raster of the same picture.

When raster is the right choice

Anything captured by a camera or scanner is raster from the start, and it should stay that way. Skin, sky, fabric and shadow are smooth blends of colour with no clean outlines to describe. MDN puts it plainly: raster graphics are “arguably better for complex precision images such as photos”.

For raster images the real choices are format and pixel size. The best image format for the web guide covers JPG, PNG, WebP and AVIF.

When vector is the right choice

Logos, icons, charts, maps, diagrams, signatures and cut designs are made of clear shapes and flat colours. As vectors they print sharply at any size and stay light on a web page. MDN also points out that “text in vector images remains accessible” and that each part of an SVG “can be styled via CSS or scripted via JavaScript”, so a site can recolour an icon without a second file.

If a designer made your logo, ask for the vector original rather than converting a PNG. It will be cleaner than any trace.

Converting between them

Vector to raster is exact and easy. The shapes are simply drawn at the pixel size you choose:

Make the raster at the largest size you will need. Scaling that PNG up later brings back all the raster problems.

Raster to vector means tracing: software groups pixels into a few colours, follows the edge of each patch and writes those edges as paths. It is an approximation, not a lossless conversion. It works well on flat artwork with a handful of colours and poorly on photos.

One trap: an .svg file is not automatically a vector. The W3C specification describes SVG as a language for “vector and mixed vector/raster graphics”, so an SVG can simply wrap a photo. The files our tracing tools produce contain only path shapes. For a walk-through of the tracing settings, see how to convert an image to SVG; for the format itself, what an SVG file is.

Questions

Is a PNG with a transparent background a vector?

No. Transparency is just another value stored for each pixel. The PNG is still a fixed grid and will blur or step when enlarged.

Does saving a picture as .svg make it a vector?

Not by itself. SVG may contain embedded raster images, so a photo wrapped in an SVG is still pixels. A true vector SVG contains only shapes, which is what our tracing tools write.

Sources

  1. Adding vector graphics to the web, MDN Web Docs. Checked December 2026.
  2. Image file type and format guide, MDN Web Docs. Checked December 2026.
  3. Scalable Vector Graphics (SVG) 2, W3C. Checked December 2026.

Browse all image guides