How to calculate an aspect ratio

Calculating an aspect ratio takes one division and a little simplifying. Here is the method, three worked examples, and the formula for finding a missing dimension.

The basic formula

An aspect ratio is just width : height reduced to its simplest whole numbers. To get it:

  1. Find the greatest common divisor (GCD) of the width and the height — the largest number that divides both exactly.
  2. Divide both the width and the height by that GCD.

The result is the aspect ratio.

Worked example: 1920 × 1080

Worked example: 1080 × 1350

Finding the GCD quickly

If you cannot spot the GCD, use the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller one, until the remainder is zero. The last non-zero number is the GCD. For 1920 and 1080: 1920 mod 1080 = 840, 1080 mod 840 = 240, 840 mod 240 = 120, 240 mod 120 = 0 → GCD is 120.

Shortcut: you do not actually need the ratio in lowest terms to work with it. The decimal value width ÷ height tells you the shape directly — 1920 ÷ 1080 ≈ 1.778, which is the same 1.778 you get from 16 ÷ 9.

Finding a missing width or height

This is the part most people actually need: you know the ratio and one dimension, and you want the other. Keep the ratio as rw : rh (for 16:9, rw = 16 and rh = 9), then:

Example

You want a 16:9 image that is 1280 px wide. Height = 1280 × 9 ÷ 16 = 720. So 1280 × 720 keeps a perfect 16:9.

Going the other way: you need a 16:9 image 900 px tall. Width = 900 × 16 ÷ 9 = 1600. So 1600 × 900.

Matching an existing image's ratio

To resize a photo without distorting it, calculate its ratio once (width ÷ height) and reuse it. If a 4000 × 3000 photo (4:3) needs to fit a 1200 px width, the height is 1200 × 3 ÷ 4 = 900. Any other height would stretch or squash the image.

Skip the maths

RatioForge does every calculation on this page for you — type a width or height, pick a ratio, or drop an image to read its ratio automatically.

Open the calculator