Here are some fragments from the same .svg file made and saved by Inkscape:

<svg width="150" height="150" version="1.1" viewBox="0 0 39.688 39.688" ...
<path d="m-117.51 88.274c-1.6578 0.02054-2.2324 1.3125-4.1072 2.8502-0.85358...

The width and height are in px (because that was the unit I used to transform the shape - the values match). The viewbox unit is, apparently, in mm (because I used them to resize the document - again, the values match). So, svg doesn't care about mixing different units of measurement in the same file? Also, I couldn't find where it says specifically in the file which units are being used - very confusing.

However, what are the units of the path - I have no idea. They don't seem to match with node coordinates in Inkscape in whichever units. Is there any way to find out, or to pick the units when saving file? I do care because I want to round them to integers (I am going to import those files into Processing, and I don't want to deal with those long decimals there), and to round them, I need to know which units to round.


2 Answers 2


SVG does not really care of the unit at all. I mean it defaults to pixels, but mm is a pretty meaningless on a web browser.

Anyway the SVG viewer does not really know the unit is a mm or anything it just knows that your view box is 0-39.688 so it now knows 150 pixels is 39.688 units in your document. It does not really care what your unit is just as ling as it knows the conversion factor. I mean it may be mm or it might not be on a different device.

Incidentally not all parts of SVG needs to be in same scale so you can have mm and inches in same document. But the semantics means nothing to the computer. YOu are making the meaning out of it. So without seeing the actual transformation stack theres little that can be done to answer your question (so we need to know all groups etc.).


Seems like a design flaw of SVG to me. If I can use any "unit" at one point, I should be able to use units throughout. At this point I dont care if a unit has a meaning to the browser! The browser is the one to follow instructions. Not the other way 'round. What do we have computers for?

There is really no sense to have

<rect x="3.5cm" y="3in" width="1cm" height="0.5cm"/>


<path d="M 3.5cm 3in h 1cm v 0.5cm h -1cm v -0.5cm" />

Other than it is NOT SVG conforming, WHAT would be wrong with it? Wouldn't it be easier to understand?

I don't need/want to deal with such inconsistencies...

New contributor
Gregorian is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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