SVG viewBox Coordinates & Path Rescaler

Recalculate internal vector path math to properly resize and normalize misaligned SVG viewBoxes without quality loss.

Transform Matrix

ViewBox & Scale
Affine Rotations & Skews
Original Geometry
No SVG loaded
Mathematically Scaled Output
Awaiting calculation
This engine applies a strict Affine Transformation Matrix to every raw node in your vector paths. Below is the computed Cartesian data.

Original System

Raw ViewBox -
Implied Width -
Implied Height -
Path Elements -

Affine Transformation Matrix

[ 1 0 0 ]
[ 0 1 0 ]
[ 0 0 1 ]
Scale X -
Scale Y -

Minification & Polish

Output File Size -
Savings -

The Cartesian Plane of SVGs

Unlike raster images (JPEGs, PNGs) which are rigid grids of colored pixels, Scalable Vector Graphics (SVGs) are pure mathematics rendered onto a Cartesian coordinate system. When an SVG is drawn, the browser essentially places an invisible piece of graphing paper onto the screen and executes algebraic functions to draw geometry (lines, cubic bezier curves, and arcs) across that graph.

The viewBox attribute (e.g., viewBox="0 0 1024 1024") defines the exact mathematical dimensions of this internal graphing paper. It explicitly tells the browser where the origin (0,0) is located and how many internal units span across the X and Y axes. Changing the CSS width or height of an SVG does NOT change this internal graphing paper—it only squishes the canvas. To truly resize a graphic for responsive iconography (like mapping an old 1024px icon to a modern 24px grid), you must physically run matrix transformations against every internal coordinate node.

Affine Transformations Explained

Our Mathematical Vector Resizing Engine doesn't just do simple division. It builds a full Affine Transformation Matrix representing the Scale, Rotation, Skew, and Translation of your desired output.

An SVG affine matrix is represented as an array of 6 values: [a, b, c, d, e, f]. Under the hood, this corresponds to a 3x3 mathematical matrix. When we want to rotate an SVG path by 45 degrees, we don't just add 45 to the numbers. We calculate the Cosine and Sine of the angle, compute the rotational shifts across both the X and Y axes, and then multiply every single MoveTo, LineTo, and CurveTo coordinate by that matrix. Because we do this on the raw source code, the resulting SVG acts as if it was natively drawn at that rotation in Adobe Illustrator, requiring no CSS transforms in the browser.

Note on Arc Scaling: Scaling elliptical arcs (`A` or `a` commands) non-uniformly or skewing them can mathematically distort an ellipse into shapes that standard SVG Arc commands cannot render perfectly. Our engine approximates these endpoints, but for extreme skew distortions on circles, converting arcs to Cubic Beziers prior to scaling is mathematically recommended.

Absolute vs Relative Paths

In an SVG `path`, commands can be uppercase (e.g. M 10 20) or lowercase (e.g. m 10 20). Uppercase commands dictate Absolute coordinates on the Cartesian plane. Lowercase commands are Relative, instructing the pen to move a certain distance from its current location.

When multiplying path data by an affine matrix, absolute coordinates must be scaled and offset by the translation matrix (`e` and `f`). However, relative coordinates only dictate distance. Thus, relative commands (`m`, `l`, `c`) must ONLY be multiplied by the scale/rotation matrix (`a, b, c, d`) and must completely ignore the translation offset. Our math engine strictly respects case-sensitivity to prevent geometry shattering.

The "non-scaling-stroke" Trick

If you've ever scaled an SVG icon in CSS and noticed that the lines became comically thick or invisibly thin, you've encountered stroke scaling. When you scale an SVG's viewBox mathematically, the stroke-width attribute must also be mathematically multiplied so the graphic looks visually identical.

Our engine offers an automated "Scale Stroke Widths" toggle to handle this algebra for you. However, as an advanced technique, you can bypass stroke scaling entirely by adding vector-effect="non-scaling-stroke" to your SVG elements. This tells the browser's rendering engine to always paint the stroke at exactly `1px` (or whatever you set), completely ignoring any viewBox matrices or CSS transforms.

Decimal Bloat & Minification

Matrix multiplication often yields floating-point atrocities (e.g. 12.3333333334). This is known as "Decimal Bloat". To combat this, our Decimal Precision Optimizer safely rounds your coordinates. We then run the output through a rigorous path minifier that strips spaces between commands and squashes negative numbers (turning M 10 -20 into M10-20). This drastically reduces the byte size of the SVG, optimizing it for production environments.

Frequently Asked Questions

SVG Basics

What does the viewBox attribute do in an SVG?
The `viewBox` attribute defines the coordinate system and aspect ratio of an SVG canvas. It specifies the position and dimension, in user space, of an SVG viewport, allowing the graphic to scale responsively.

Use Cases

Why would I need to rescale SVG paths?
When you resize an SVG's viewBox or combine multiple SVGs with different coordinate systems, the internal path data (like `d` attributes) must be mathematically scaled and translated to maintain the correct proportions. Our tool automates this complex math.

Features

Does this tool support all SVG path commands?
Yes, the rescaler handles all standard SVG path commands, including absolute and relative coordinates, arcs, cubic and quadratic bézier curves, ensuring your graphics remain perfectly intact after transformation.

Rate SVG viewBox Coordinates & Path Rescaler

Help us improve by rating this tool.

4.7/5
1,051 reviews