SVG ViewBox Calculator

Build a validated viewBox and report viewport scale factors.

Scope: This calculates viewBox source and independent scale factors; it does not render or inspect SVG markup.

Workbench

Inputs stay on this page.

Produces source and arithmetic only. SVG is not executed or rendered.

How to use SVG ViewBox Calculator

  1. Fill in the fields:

    • Minimum x: -1,000,000 to 1,000,000.
    • Minimum y: -1,000,000 to 1,000,000.
    • Content width: 0.001 to 1,000,000.
    • Content height: 0.001 to 1,000,000.
    • Padding: 0 to 1,000,000.
    • Viewport width: 0.001 to 1,000,000.
    • Viewport height: 0.001 to 1,000,000.
    • Preserve aspect ratio: Centre, meet, Top-left, meet, Bottom-right, meet, Centre, slice, None.
  2. Press “Calculate viewBox”.

  3. Copy the result, or download it as svg-viewbox.json.

About this tool

Build a validated viewBox and report viewport scale factors.

Produces source and arithmetic only. SVG is not executed or rendered.