Free SVG cropper

Crop SVG to content

Trim empty space around SVG artwork by fitting the viewBox to the visible shapes. The paths themselves are not rewritten, so nothing is resampled or simplified — only the window onto the drawing changes.

Drop an SVG file to crop

or

Runs in your browser · Nothing is uploaded · No account

What cropping an SVG actually changes

An SVG has two ideas of size. The viewBox is the rectangle in the file's own coordinates that is mapped onto the page. The width and height attributes are how large that rectangle is drawn. Extra whitespace almost always means the viewBox is larger than the ink: the file was exported with a whole artboard, shapes were moved or deleted, or an icon sits on a padded grid.

This cropper changes the viewBox (and sets matching width and height). It does not scale, move or delete elements. If the file had a preserveAspectRatio attribute, that is removed so the new box is used as-is.

A worked example, with the numbers

Take a 100 × 100 canvas with a circle of radius 20 at the centre. The ink only occupies the middle 40 units, so you see a lot of empty margin:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
  <circle cx="50" cy="50" r="20" fill="#3b5bdb"/>
</svg>

The content box is x = 50 − 20 = 30, y = 30, width = 40, height = 40. After a crop with padding at 0, the file becomes:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="30 30 40 40" width="40" height="40">
  <circle cx="50" cy="50" r="20" fill="#3b5bdb"/>
</svg>

The circle element is unchanged — its centre is still (50, 50) in the original coordinates. The new viewBox starts at (30, 30), so the circle now fills the frame. With padding set to 4, the tool subtracts 4 from x and y and adds 8 to each side, giving viewBox="26 26 48 48" and a 48 × 48 width and height. That padding is useful when the shape has a stroke (see below).

How to use the cropper

  1. Drop an SVG file onto the tool, or paste the markup. The file is not uploaded; measurement happens in your browser.
  2. Two previews appear: Original on the left, Cropped in the middle. The cropped caption also shows the new size, rounded to whole units, for example 40 × 40.
  3. Use the Padding slider (0 to 64) if you want a margin around the ink, or if a stroke is being clipped.
  4. Download the result (the filename gets a -cropped suffix), copy the markup, or open it in the editor for a manual tweak. Reset starts over with a new file.

Strokes, hidden leftovers and empty files

The browser's getBBox() reports the geometry of the paths and shapes, not the thickness of a stroke. A circle with r="20" and stroke-width="8" still measures 40 units across, but the paint extends 4 units past that box. At padding 0 the stroke is clipped on all four sides. Move padding to at least half the stroke width to keep the outline.

Shapes with no visible paint, or a file whose content measures zero width or height, produce the error “No visible content to crop to.” That can happen with an empty artboard, or with artwork that only exists as a stroke so thin or so far out of view that the box collapses. Open the file in the SVG viewer if you need to inspect the markup first.

Because crop does not delete elements, a stray path parked far off the artboard still lives in the file after a tight crop. It will not show, but it can confuse the next edit and add bytes. If the file used to have a huge canvas, check the editor layers after cropping and delete anything you did not mean to keep.

When not to crop, and what to do instead

Leave the padding alone on icons that belong to a set. Designers put a 24 × 24 (or 16 × 16) grid around each glyph on purpose, so a “play” triangle and a “pause” pair of bars line up optically. Cropping each one to its ink makes the triangle look larger than the bars. Crop the finished logo or illustration, not the individual set glyphs.

Cropping is also the wrong tool when you want a different display size but the same canvas. That is Resize SVG, which changes width and height (or strips them for a responsive file) and leaves the viewBox alone. If you need a custom window that is not the content bounds — for example a square frame around a wide wordmark — set the artboard in the editor and position the artwork yourself.

Once the frame is tight, the SVG to PNG converter will export a bitmap without a ring of empty pixels, which is what you want for a sticker or a tightly cropped logo. For print at a chosen DPI, follow that with how to convert SVG to PNG for print.

Questions

How do I remove the whitespace around an SVG?

Drop the file into the cropper above. The tool measures the visible shapes with the browser's getBBox, then shrinks the viewBox (and the width and height attributes) to that box. Move the Padding slider if you want a margin, then download the cropped SVG.

Does cropping delete parts of my drawing?

No. Only the visible window changes. Every element stays in the markup, including shapes that now sit outside the new viewBox. They are simply not shown. Hidden off-canvas leftovers can still add weight, so delete them in the editor if you no longer need them.

Why are thick strokes clipped at the edges?

Browsers measure shape geometry without stroke width. A circle of radius 20 with a stroke of 8 has a 40-unit bounding box, but the stroke sticks out by 4 units on each side. Set Padding to at least half the stroke width (4 in that example). The slider goes from 0 to 64, in the SVG's own user units.

What units is the padding slider in?

User units of the SVG, the same units as the viewBox, not CSS pixels. On a 24 × 24 icon grid, a padding of 2 is two grid units. On a 512 × 512 artboard, 2 is a much smaller visual margin.

Should I crop icons from a set?

Usually not. Icon sets share a fixed grid (often 24 × 24) with equal padding so every glyph aligns when they sit side by side. Cropping each icon to its ink makes the optical sizes jump. Crop one-off logos and illustrations instead.

Can I crop to a custom rectangle, not the content bounds?

This tool only fits the viewBox to the measured content, plus padding. For a custom crop, open the file in the Vectopea editor and set the artboard size numerically, then move the artwork inside it.