SVG viewBox Optimizer & Cropper
SVGs frequently ship with excess whitespace or a wrong viewBox, wasting
bytes and breaking responsive sizing. Measure the true content bounds, crop visually,
preview preserveAspectRatio, and export a clean SVG.
Tool interface
Optimize
Original
Optimized
preserveAspectRatio in a wide (2:1) frame
Introduction
A loose viewBox makes icons render small inside their box and adds dead
space to illustrations. Tightening it improves sizing and reduces layout surprises.
How it works
- The SVG is parsed and rendered off-screen to measure the content bounding box.
- You trim or manually set the viewBox and preview the result.
- The optimized SVG is serialized for copy or download.
Privacy
All measurement and serialization is local. No upload, no account, no API key.
Limitations
- Cannot infer intended whitespace; cropping is a design decision.
getBBox()may not account for strokes at edges — add padding if needed.
FAQ
What is a viewBox?
It defines the internal coordinate window of the SVG — the region that gets scaled to fit the element's size.
Is my SVG uploaded?
No. Everything runs locally.