Skip to main content
>_devtools

SVG viewBox Helper

Fit, crop, pad, or square an SVG viewBox from its content bounds, and see how preserveAspectRatio places it.

How to use it

Fit, crop, pad, or square an SVG viewBox from its content bounds, and see how preserveAspectRatio places it. Paste SVG markup above, fit the viewBox to its measured shapes, and adjust padding or viewport behavior.

Example

Input bounds: x=60, y=40, width=80, height=103
Output viewBox: 56 36 88 111 with 4 units of padding

Limits and behavior

  • Transformed elements, text, images, use, and nested SVG shapes are not measured.
  • Markup is limited to 1 MiB.