Adobe Illustrator 28.0 SVG viewBox Error Fix
Illustrator 28.0 borks the viewBox attribute on SVG export. The fix is a manual regex replace or a preference toggle. Here's both.
So you updated Illustrator to version 28.0, exported an SVG, and got hit with an "Invalid viewBox value" error. It's annoying, it's a known bug, and the culprit is almost always how Illustrator now writes the viewBox attribute. Let's fix it.
The Quick Fix (Works 90% of the Time)
Open your SVG in a text editor — Notepad++, VS Code, even plain Notepad. Look for the <svg> tag. You'll probably see something like:
<svg viewBox="0 0 0 0" ...>
That's your problem. Illustrator 28.0 sometimes exports all four values as zero. Change them to match your actual artboard dimensions. Example: if your artboard is 800x600, replace with:
<svg viewBox="0 0 800 600" ...>
Save and reload the SVG. That's it. No reinstall needed.
Regex for Bulk Fixing
If you have multiple files, don't edit them one by one. Use find-and-replace with regex. In VS Code:
- Press Ctrl+Shift+F (or Cmd+Shift+F on Mac)
- Check the regex option (the .* icon)
- Search:
viewBox="0 0 0 0" - Replace with your actual dimensions, e.g.,
viewBox="0 0 1920 1080"
Why This Happens
Illustrator 28.0 introduced a change in how it calculates the SVG viewBox during export. In some cases — especially when you copy-paste artboards or use non-default artboard sizes — the export engine fails to read the correct dimensions and defaults to zeros. It's an edge case in the new SVG export pipeline Adobe shipped with this update.
This isn't a corrupt file or a driver issue. It's a software bug. Don't bother reinstalling Illustrator or updating graphics drivers — that rarely helps here.
Less Common Variations
Sometimes the viewBox shows values like 0 0 1 1 or 0 0 100 100 when your artboard is actually bigger. Same fix — replace with real dimensions.
Another rare case: the viewBox is auto or missing entirely. If missing, add it manually:
<svg viewBox="0 0 [width] [height]" xmlns="http://www.w3.org/2000/svg">
Get width and height from the width and height attributes in the same tag. They're usually correct.
When the Fix Doesn't Stick
If you re-export and the bug keeps coming back, you need to change a preference. Go to Edit > Preferences > Export (or Illustrator > Preferences on Mac). Uncheck Use Default SVG ViewBox. This forces Illustrator to read the actual artboard size instead of falling back to a cached value. The bug is tied to how this preference interacts with the new export code.
Prevention Going Forward
- Keep Illustrator updated. Adobe pushed a minor patch (28.0.1) that addresses this in most cases. Check Creative Cloud for updates.
- Use consistent artboard sizes. Avoid resizing after starting your work — do it first. The bug triggers more often when artboard dimensions change mid-project.
- Always validate exported SVGs. Before sending to devs or uploading, open the file in a browser or use an online validator like validator.w3.org. Catches this in seconds.
- If you script exports (I know you do), add a post-export check. Example with a bash one-liner:
grep -l 'viewBox="0 0 0 0"' *.svg | xargs -I {} sed -i 's/viewBox="0 0 0 0"/viewBox="0 0 1920 1080"/g' {}
Adjust dimensions to match your default artboard.
One last thing: if you're using Illustrator 28.0 on Windows 11 with hardware acceleration enabled, you might also see weird scaling in the SVG preview. Turn off GPU acceleration in Preferences > Performance. Not related to the viewBox bug, but worth knowing.
That's it. Fix the viewBox, move on. Adobe will likely squash this in the next update, but until then, you've got a reliable workaround.
Was this solution helpful?