Skip to content
Built in Lahore, PakistanHow we check the math
mathbehind

Aspect Ratio Calculator

Find the aspect ratio of any width and height, and work out the matching height when you resize to a new width.

By Muhammad Ahmad, Software EngineerLinkedIn

Your numbers

px
px
px

The height that keeps the same proportions is shown below.

Aspect ratio

16:9

Height at the new width
720.00 px
As a decimal (width ÷ height)
1.7778
CSS aspect-ratio value
16 / 9
The math behind it
  1. Divide both sides by their common factor

    1,920 ÷ 120 : 1,080 ÷ 120equals16:9

  2. Height at the new width

    1,280 × 1,080 ÷ 1,920equals720 px

An aspect ratio is the shape of an image or screen, written as width to height. Keeping it the same when you resize is what stops photos and videos from looking stretched or squashed.

How it works

The calculator finds the greatest common divisor of the width and height, the largest number that divides both exactly, and divides both by it. For 1920 × 1080 that number is 120, which gives 16:9.

To resize without distortion, multiply the new width by the original height, then divide by the original width.

Some sizes do not reduce to a familiar ratio. 1366 × 768, a common laptop screen, is 683:384, which is close to 16:9 but not exact.

A worked example

1920 × 1080 has a 16:9 aspect ratio, about 1.7778 as a decimal. Resized to 1280 pixels wide, it should be 720 pixels high to keep the same shape.

More examples

An ultrawide 2560 × 1080 screen is really 64:27 (2.37), not 21:9. A 1080 × 1350 portrait image is 4:5; resized to 720 wide it becomes 720 × 900.

Common mistakes

  • Changing width and height independently, which distorts the image.
  • Assuming marketing names like 21:9 are exact.
  • Upscaling small images, which loses quality.
  • Placing important content near edges that apps may crop.

Questions people ask

What happens if I resize an image to a different aspect ratio?

It gets stretched or squashed unless you crop it or add bars. Cropping to a narrower ratio cuts the sides, and letterboxing keeps the whole image with empty space around it. In CSS these are object-fit: cover and object-fit: contain.

What are the most common aspect ratios?

16:9 for most video and screens, 4:3 for older displays and many tablets, 1:1 for square social posts, 9:16 for vertical phone video, and 3:2 for many camera sensors.

How do I use this in CSS?

Copy the CSS aspect-ratio value, such as 16 / 9, into the aspect-ratio property. The browser then keeps the element in that shape as its width changes.

Why is the new height a decimal?

Some widths do not divide evenly into the ratio. Round to the nearest whole pixel, or pick a width that is a multiple of the ratio's first number, such as a multiple of 16 for 16:9.

What aspect ratio is 1920 × 1080?

16:9. Both numbers divide by 120: 1920 ÷ 120 = 16 and 1080 ÷ 120 = 9. 1280 × 720 and 3840 × 2160 are also 16:9.

How do I calculate an aspect ratio?

Divide the width and height by their greatest common divisor. For 1200 × 800 the greatest common divisor is 400, so the ratio is 3:2.