Skip to content
FixMySVG

SVG structure

SVG missing viewBox: what it does and when it’s safe to add one

By FixMySVG · Published Oct 4, 2026 · 8 min read

Part of: SVG not uploading to Cricut

An SVG with no viewBox still displays, but only at the exact width and height written in the file, and any program that resizes it has to guess how the drawing should scale. The viewBox is a set of four numbers that defines the drawing’s coordinate system. Adding the right one is often a one-line fix — as long as you know which numbers are right.

On this page

What the viewBox is

MDN describes the viewBox attribute as defining “the position and dimension, in user space, of an SVG viewport” (MDN: viewBox). In plain terms, it tells a program which rectangle of the drawing’s coordinates to show. It is always four numbers, separated by spaces or commas:

  • min-x and min-y: the coordinates of the rectangle’s top-left corner, usually 0 0.
  • width and height: how wide and tall the rectangle is, in the drawing’s own units.

The shapes in an SVG are written in these units, called user units. A circle with cx="200" sits 200 units from the left edge, whatever size the file is eventually shown at. The viewBox says how many of those units span the visible area, and the program maps that rectangle onto the space it has (W3C SVG 2: the viewBox attribute).

How width, height and viewBox work together

The width and height on the <svg> element say how big the image should be displayed or printed. The viewBox says which coordinate system is drawn inside that space. Together they set the scale:

<svg width="4in" height="3in" viewBox="0 0 400 300">
A 400 × 300 unit drawing shown in a 4 × 3 inch space: 100 units per inch.

Change the size to 8in × 6in and the same drawing doubles, with no change to the shapes. That is what makes a file with a viewBox scale predictably. Keep the two ratios matched — 400:300 and 4:3 here — or the drawing gains empty margins; why an SVG comes into Cricut at the wrong size covers units, pixels per inch and aspect ratio in detail.

What happens when the viewBox is missing

Without a viewBox, the SVG spec says one user unit equals one CSS pixel (W3C SVG 2). The drawing is pinned to its width and height in pixels: shown at exactly that size it looks fine, but it carries no instruction for scaling. In a browser, giving such a file a different width and height changes the visible area rather than the drawing, so the artwork gets cropped or sits in empty space.

Design apps and cutting software each fill the gap in their own way, so a file without a viewBox may import at a size you didn’t expect — a problem Cricut users commonly report with pixel-sized files. Cricut’s help pages don’t list any viewBox requirement, so treat the viewBox as general SVG best practice, and as something FixMySVG warns about, rather than as a documented Cricut rule.

Real analyzer result

Sample file: 12-missing-viewbox.svg

A pixel-sized file with no viewBox

Paths
3
Commands (≈ nodes)
39
Elements
4
Groups
0
File size
533 B
Size
1200px × 900px
viewBox
none
Complexity
Low

Cricut compatibility: Needs attention

  • Missing viewBox
Width 1200px, height 900px and no viewBox. FixMySVG’s analyzer marks it Needs attention; because the width and height are known, Safe Fix can add a matching viewBox.Open this sample in the checker →

Invalid viewBox values

A viewBox that is present but broken can be worse than none at all. It needs exactly four numbers, and the width and height must be positive. MDN notes that width or height values “lower or equal to 0 disable rendering of the element”; the W3C spec calls a negative width or height an error that invalidates the attribute, and says zero disables rendering. Programs cope with this differently, so the result can be anything from a blank image to a drawing at the wrong scale. Typical mistakes:

  • a negative width or height, such as 0 0 -400 300;
  • a zero width or height, such as 0 0 0 300;
  • the wrong number of values, such as 0 0 400;
  • units or percentages inside the list, such as 0 0 400px 300px — the viewBox only takes plain numbers.

Real analyzer result

Sample file: 09-problematic-viewbox.svg

A negative viewBox width

Paths
3
Commands (≈ nodes)
17
Elements
4
Groups
0
File size
387 B
Size
400px × 300px
viewBox
0 0 -400 300
Complexity
Low

Cricut compatibility: Not ready

  • Invalid viewBox
The file is 400px × 300px, but its viewBox is 0 0 -400 300. FixMySVG’s analyzer flags the viewBox as invalid and marks the file Not ready. The intended value is 0 0 400 300.Open this sample in the checker →

If a broken viewBox leaves you with an empty upload, why an SVG shows up blank in Cricut covers the other causes worth ruling out.

When adding a viewBox is safe

When the width and height are plain numbers or pixels and the artwork was drawn in that coordinate system — the normal case for a file without a viewBox — adding viewBox="0 0 W H" with the same numbers reproduces exactly what you see now. Nothing moves; the file simply gains a scaling rule.

<!-- antes -->
<svg xmlns="http://www.w3.org/2000/svg" width="1200px" height="900px">

<!-- después -->
<svg xmlns="http://www.w3.org/2000/svg" width="1200px" height="900px"
     viewBox="0 0 1200 900">
The viewBox repeats the width and height as plain numbers. The shapes inside don’t change.

This is what Safe Fix does when the width and height are known: it adds the matching viewBox, renders the file before and after, and compares the pixels. If anything would look different, the change is undone. It runs in the online checker that fixes SVGs for Cricut, included in the free plan with a daily allowance.

Watch out

If you add a viewBox by hand and the width and height use physical units, the viewBox still has to be in user units — pixels, when there is no viewBox, at 96 per inch (W3C CSS Values: absolute lengths). A file with width="6in" height="6in" needs viewBox="0 0 576 576". Writing 0 0 6 6 would blow up a tiny corner of the drawing to fill the whole space.

When it isn’t safe, or isn’t enough

  • Percentage sizes such as width="100%". There is no fixed size to copy, so any viewBox would be a guess based on where the shapes happen to be.
  • No width or height at all. The same problem: nothing to build the viewBox from. FixMySVG reports it and leaves the choice to you.
  • Artwork far outside the canvas. A matching viewBox keeps the same crop, so shapes outside the width × height area stay outside. If they belong to the design, fit the canvas to the artwork instead — in Inkscape, Edit › Resize Page to Selection — and export again.
  • A viewBox that doesn’t match the content. If the file has a valid viewBox but most of the drawing sits outside it, there is no automatic answer: fit the artboard to the artwork in your design app and export a fresh file.

Add a missing viewBox safely

If the width and height are known, Safe Fix adds a matching viewBox and shows you a before/after comparison.

Fix my SVG

A word on preserveAspectRatio

When the viewBox and the width and height have different proportions, the preserveAspectRatio attribute decides what happens. The default, xMidYMid meet, scales the drawing evenly until the whole viewBox fits and centres it, leaving empty bands on two sides; none stretches the drawing to fill the space and distorts it (MDN: preserveAspectRatio). For cut files, the simplest approach is to keep the ratios matched so the attribute never comes into play.

How to check and fix your viewBox

Check your SVG’s viewBox and size

Drop an SVG here

or

One .svg file, up to 15 MB.

Processed in your browser — your SVG stays on your device.

The checker shows the viewBox, width and height, units, both aspect ratios and the physical size, and labels the viewBox valid, missing or invalid. It also warns when the proportions don’t match and when the artwork sits outside the viewBox. It is also available as a standalone viewBox checker. Depending on the result:

  1. Missing, with a width and height: let Safe Fix add it, or add viewBox="0 0 W H" yourself using the pixel values.
  2. Missing, with no usable size: set the document size in your design app and export again.
  3. Invalid: let Safe Fix replace it when the width and height are known, or correct the four numbers yourself (usually 0 0 followed by the width and height in pixels), or export again from your design app.
  4. Different proportions: decide whether the viewBox or the width and height is right, then make the other one match.
  5. Artwork outside the viewBox: the canvas doesn’t line up with the artwork. Fit the artboard to the artwork and export again.

In Inkscape, Document Properties shows the page size, units, scale and viewBox in one place. The checklist for preparing an SVG for Cricut covers the other export settings, and if the viewBox turns out fine but the upload still fails, the complete guide to SVGs not uploading to Cricut goes through the remaining causes.

What FixMySVG can and can’t do

What FixMySVG can and can’t do

  • Automatically fixableAdds a missing viewBox when the width and height are known, matching them exactly, and verifies the change by comparing renders before and after.
  • Manual action recommendedChoosing a size for a file whose width and height are missing or in percent, and fitting the canvas to the artwork when shapes sit outside it. FixMySVG explains what it found and what to change.
  • Can’t be reliably repaired automaticallyDeciding which size or crop you intended when the file doesn’t say, or whether shapes outside the canvas belong to your design.

Check the whole file, not just the viewBox

The checker also covers Cricut’s 5,000-path limit, editable text, clipping paths and more, with Safe Fix for what can be repaired.

Check my SVG — free

Frequently asked questions

Does Cricut require a viewBox in SVG files?
Cricut’s help pages don’t list a viewBox requirement. It is general SVG best practice, and FixMySVG warns when it is missing because the size and scaling are then left to each program to work out.
What numbers should go in the viewBox?
Usually 0 0 followed by the drawing’s width and height in user units. For a file without a viewBox those are its width and height in pixels, so a 1200px × 900px file gets 0 0 1200 900.
Does adding a viewBox change the size of my design?
Not if it matches the width and height: the file looks exactly the same at its own size and simply scales predictably. Choosing the physical size you want to cut is a separate step.
Can a wrong viewBox make my design disappear?
Yes. A width or height of zero or less can stop the drawing from rendering, and anything outside the rectangle the viewBox defines isn’t shown.
What is the difference between viewBox and width and height?
Width and height set how big the image is displayed or printed. The viewBox sets which coordinates are drawn inside that space, so together they determine the scale.

Sources