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:
- Find the greatest common divisor (GCD) of the width and the height — the largest number that divides both exactly.
- Divide both the width and the height by that GCD.
The result is the aspect ratio.
Worked example: 1920 × 1080
- Width = 1920, height = 1080.
- The GCD of 1920 and 1080 is 120.
- 1920 ÷ 120 = 16, and 1080 ÷ 120 = 9.
- So 1920 × 1080 is 16:9.
Worked example: 1080 × 1350
- The GCD of 1080 and 1350 is 270.
- 1080 ÷ 270 = 4, and 1350 ÷ 270 = 5.
- So 1080 × 1350 is 4:5 — the Instagram portrait post.
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:
- Have the width, need the height: height = width × rh ÷ rw
- Have the height, need the width: width = height × rw ÷ rh
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