Home · Math · Ratios & Proportions · CSS Aspect Ratio Calculator

CSS Aspect Ratio Calculator

Before the CSS aspect-ratio property, a responsive box kept its shape with a padding-top percentage equal to height over width; both describe the same proportion.

Your figures

Example result — edit the figures to make it yours

56.25

Padding-top percentage for a responsive box

Aspect ratio decimal (w ÷ h)1.7778

What this calculator does

Before the CSS aspect-ratio property, a responsive box kept its shape with a padding-top percentage equal to height over width; both describe the same proportion. Every figure on this page is computed from the formula or definition stated below, with no hidden rounding steps, and the method notes name the exact convention where more than one exists.

The formula and method

padding-top % = Height ÷ Width × 100%

Before the CSS aspect-ratio property, a responsive box kept its shape with a padding-top percentage equal to height over width; both describe the same proportion.

Inputs use the units shown in the field labels and every denominator or total must be non-zero. The result is an arithmetic value from the stated formula only; it is not a quote, a rating or professional advice. Percent fields hold the percent number itself (6.5 means 6.5%); expressions divide by 100 wherever a fraction is needed, and percentage results are reported back as percent numbers.

Worked example

With the example inputs this page opens with (width 16, height 9), the result is 56.25 — padding-top percentage for a responsive box. Change any figure and the result updates with the same formula.

Quick reference

Quick reference — varying width
WidthPadding-top percentage for a responsive box
8112.50
12.870.31
1656.25
2045.00
2437.50
3228.13

Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.

Common questions

How does the CSS Aspect Ratio Calculator work?

Before the CSS aspect-ratio property, a responsive box kept its shape with a padding-top percentage equal to height over width; both describe the same proportion. Width · Height → Padding-top percentage for a responsive box. The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.

What inputs does the CSS Aspect Ratio Calculator need?

Width · Height → Padding-top percentage for a responsive box. Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.

Is the CSS Aspect Ratio Calculator free to use?

Yes. It runs entirely in your browser with no sign-up, and the same calculator is available as an embeddable widget via the Embed button, so it can be placed on another site with its calculation intact.