svg2all

Fix SVG viewBox

Adds a missing viewBox from width and height so the SVG finally scales – in your browser.

Runs in your browser – your file is never uploaded

Loading tool …

Frequently asked questions

Is my file uploaded?

No. The conversion runs entirely in your browser. The file never leaves your device – there is no server that could see it. Once the page has loaded, the tool even works offline.

What does the viewBox do, and why is it missing?

The viewBox tells the browser which part of the drawing the file shows and lets the SVG scale to any size. Some exporters only write width and height; such a file then always renders at that fixed size – a 24 px icon stays 24 px however large you make it, or gets cropped. Adding a viewBox that matches width and height fixes that without changing the drawing.

What exactly is changed?

Only the root <svg> tag: a viewBox is added when it is missing, or rewritten when it is malformed (wrong number of values, zero or negative size). Width and height in pt, mm, cm or in are converted to pixels at 96 dpi, as CSS defines it. Everything else in the file stays byte for byte as it was – a valid viewBox is never touched.

When should I remove width and height?

When the SVG should adapt to its container – inline icons, responsive logos, CSS backgrounds. Without width and height the browser sizes it by the CSS or <img> dimensions, keeping the aspect ratio from the viewBox. Keep them for a file that must have a fixed natural size, such as a print export.

Why does it say the size is unknown?

Width and height in percent, em or ex depend on the surroundings, so no pixel size can be derived. Open the file in your editor, set an absolute size (for example 64 × 48 px) and try again.