Aspect Ratio Calculator

Find an exact width-to-height ratio, then calculate a matching pixel size. See the original proportion, the unrounded answer, and what your chosen rounding rule changes.

1. Set the source ratio

Enter dimensions in the same unit, or ratio components such as 16 and 9. Width always comes first.

Each number: 0.000001 to 1,000,000,000, up to 6 decimal places. Use a decimal point; omit commas, units, and exponent notation.

Or choose a ratio (replaces the two source values):

2. Calculate a matching size

Optional. The source defines the shape; the known dimension below is in pixels (px).

Your known dimension stays unchanged. Raster images need whole pixels on both sides; CSS can use fractions.

Your exact ratio

Enter two valid source values to see the ratio.

Matching dimensions

Enter valid source values and a target dimension.

How to use the calculator

  1. Enter the original width and height, or two ratio components. Both source measurements must use the same unit. A 1920 × 1080 image reduces to 16:9; a 1080 × 1920 image reduces to 9:16.
  2. Choose whether you know the new width or height, then enter that dimension in pixels. The other side is calculated from the exact source ratio.
  3. Choose the rounding rule your output needs. Copy the reduced ratio, the resulting dimensions, or a CSS declaration. Reset restores the 1920 × 1080 example.

What the numbers mean

Aspect ratio describes shape, not resolution. Divide both dimensions by their greatest common divisor to reduce the ratio. Decimal inputs are first converted to exact integers at the same scale. For example, 1.5:1 reduces to 3:2. The decimal ratio is width divided by height and is labeled when rounded.

To calculate height, use new height = new width × source height ÷ source width. To calculate width, reverse the two source sides. At 16:9, a width of 1280px gives exactly 720px in height.

Rounding can change the shape

A width of 100px at 16:9 gives exactly 56.25px in height. Nearest and down produce 56px; up produces 57px. The result shows the exact fraction and the actual ratio after rounding. Deviation measures the absolute percentage change in width/height from the source ratio. Nearest rounds exact halves upward; decimal mode uses that rule at six decimal places. If rounding makes a side zero, choose a larger target or a different rounding rule.

Keep both dimensions whole for raster image exports. A decimal target stays decimal even when the calculated side is rounded to a whole pixel. This tool calculates dimensions; it does not resize, crop, pad, or upload an image. It assumes square pixels and does not validate a video codec, file size, print resolution, or a platform’s upload requirements.

Using the CSS output

aspect-ratio: 16 / 9; sets a preferred width-to-height ratio. Leave at least one dimension automatic for it to affect sizing, for example with width: 100%; height: auto;. Other constraints, content, intrinsic image sizing, and box-sizing can affect the final layout. See the W3C aspect-ratio specification and CSS ratio syntax.

Limits and privacy

Use positive numbers from 0.000001 through 1,000,000,000 with at most six decimal places. The exact calculated side must also fall in this range. Inputs are limited to 32 characters; scientific notation and unit conversions are not supported. The preview is hidden for extreme proportions that cannot be drawn legibly. Exact fractions and reduced ratios remain authoritative when a decimal display is approximate.

Calculations run locally in your browser and are not uploaded or saved by this calculator. Copying writes only the selected result to your clipboard when permitted. The site’s shared page analytics may still run independently; calculator values are not sent to them by this tool.