Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a SVG file with viewBox="-155.7 -99 510 510". I believe this offset the paths in Mac OS X preview by -155.7 -99. when I open the SVG in Illustrator, the paths are not offset at all. how do I export this svg such that:

  1. viewBox="0 0 510 510"
  2. and all the paths have added off set of -155.7 -99

I have tried changing the position of the artboard but the origin of viewbox is never 0,0.

share|improve this question
up vote 6 down vote accepted

I did a little research on SVG's and apparently the viewbox is not a element that is exportable via Illustrator. The viewbox element is only compatible with certain programs that chose to use this element or manipulate it. Sadly, Illustrator is not one of them.

If you saved the SVG from Illustrator without "Preserve Illustrator Editing Capabilities" you can reverse the process. Whatever changes you make in the data of the SVG file will then be reflected in Illustrator but through repositioning and resizing both the Artboard and Layers to create a pseudo-viewbox.

For now all you can do is design work in Illustrator and all extra code for offset and positioning of the viewbox within the file data. You can make a pseudo-viewbox by simply changing the Artboards Width + Height/X + Y position and then changing the objects Size and Position attributes as well. But there will never be a true viewbox attribute unless they release an update to Illustrator with editable viewbox features.

Some reading on the SVG Format in Illustrator: Adobe Illustrator Save in SVG Format

share|improve this answer
Illustrator does export the viewbox attribute as of Illustrator CC (v 17.x). – Jake Wilson Oct 6 '14 at 19:03

I've run into this problem several times, and the only thing that has ever worked for me to reliably reset the SVG viewbox to precisely 0, 0 when exporting from Illustrator is to create a new blank document and copy and paste the artwork into it.

The top left corner of this untouched default artboard will export as point 0, 0 of the view box. Use smart guides (cmd-u) or the align window set to Align to Artboard if you need your artwork to start at exactly 0, 0.

You can safely resize the artboard from the bottom right corner, but things start to go wrong if you move the top left corner. Moving the artboards' top left corner or importing SVG files to AI seems to cause some kind of weird internal disconnect between the rulers, artboards and some sort of invisible secret viewbox origin point known only to Illustrator.

AFAICT, as with most things to do with web or emerging technology, Adobe's approach to SVG has been to throw something crudely together so they can boast about it in a press release, then leave it buggy, unfinished and unloved, pretending it doesn't exist and carrying on like it's 1998.

share|improve this answer
This does not work for me using Illustrator CC. I've also tried the Fit Artboard to Artwork custom size. The final SVG always has a viewport that is centered. – wprater Dec 8 '13 at 0:22
Strange - definitely can work in CS6. Must have changed between CS6 and CC - seems like an odd change though. – user568458 Dec 9 '13 at 9:54
@user568458 This is the technique that I also use, not exact but very similar. Any transformations to the 'Artboard' in Illustrator will directly translate to the values of the viewbox being altered on exporting to SVG. You are completely correct in creating a new document and copying over all artwork. Your answer should be marked as correct +1. – Terry Feb 2 '14 at 19:34
Adobe was a big supporter of SVG but that was when svg was emerging they haven't done anything on this front in several years after the Macromedia acquisition because they wanted flash to succeed. – joojaa Aug 4 '14 at 9:14
I'm using Adobe Illustrator CC 18.1.0 and creating a completely new document, copying and pasting my svg, and then resaving seems to do the trick. I also make sure to check Preserve Illustrator Editing Capabilities the first time I save just in case I need to make more adjustments and then after I think everything is pretty good, I save it without it (the increase in file size is pretty significant so you will want to do this) – aug Jan 6 '15 at 18:59

I know this is very late to the topic, but I had this same issue and did the following.

  1. Open the SVG in a text editor and change the viewBox attribute to 0 0 x y
  2. Save it out and reopen in Illustrator
  3. The artwork will now be positioned outside of the artboard - move it back to 0 0
  4. Save and preview, it should all be working fine.

Hope this helps somebody else.

share|improve this answer
Hello Mark, welcome to GDSE and thanks for your answer. If you have any questions, please see the help center or ping one of us in chat once your reputation is sufficient (20). Keep contributing and enjoy the site! – Zach Saucier Apr 25 '15 at 13:14
I've found adding width="<W>" height="<H>" in your favorite text editor to the SVG tag also helps (where <W> and <H> would be decimal numbers). – jaepage Jul 28 '15 at 21:28

I had a very similar problem that my AI created SVG was not centered and expanded to the full browser window, because AI keeps changing the artboard size and forgets about the centering.

The only way to fix it is to have a final manual processing step in Inkscape.

  • open the SVG in Inkscape
  • resize the canvas under File -> Document Properties
  • resize & move your artwork by selecting it and entering the w, h in the toolbar edits

Finally, you have to save the SVG again, but use the format "Optimized SVG" in the Save As dialog. There will be a dialog for SVG options and you have to enable "Enable viewboxing".

As all my SVGs are icons of the same size, this processing step takes only 1 minute as I always have the same canvas and object size. But yes, it is a shame that this step is needed at all and it should be fixed in AI.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.