What is the difference between raster and vector images?
Raster images are grids of colored pixels fixed at one resolution, while vector images describe shapes with math so they scale to any size without losing sharpness.
By Rocco Bombardieri · Updated
Want the full walkthrough? Read: WebP vs PNG for logos and graphics →
Explained in more detail
A raster image, also called a bitmap, stores a grid of pixels. PNG, JPEG, WebP, AVIF and GIF are all raster formats. The image has a fixed number of pixels, so enlarging it past that makes it soft or blocky. Raster is the right model for photographs and any image whose detail cannot be described as simple shapes.
A vector image stores instructions: draw a circle here, a curve with these control points there, fill it with this color. SVG is the standard vector format on the web. Because the image is a set of equations, it can be drawn at any size, from a favicon to a billboard, with perfectly crisp edges. Vector files for simple artwork are also tiny.
The choice follows the content. Logos, icons and diagrams are best kept as vectors, and exported to raster only when a platform demands it. Photographs, screenshots and complex textures are inherently raster.
Converting between them is not symmetrical. Rasterizing a vector is easy: pick the pixel size and render it. Tracing a raster back into vectors is approximate, and works well only for simple, flat artwork.
Many tools work only on rasters. Trimming, background removal, resizing and format conversion all operate on pixels, and an SVG has to be rasterized first. When you rasterize, render at the largest size you will need, since you can scale down later without much loss but cannot scale up.