How to Calculate Aspect Ratio from Pixels (Step-by-Step)

Screen Ruler TeamApril 25, 20267 min read
how to calculate aspect ratioaspect ratio from pixelssimplify aspect ratio

You have a pair of pixel dimensions — 1920 × 1080, 2160 × 3840, 2390 × 1000 — and you need to know what aspect ratio they describe. The answer always lives one short calculation away: divide both numbers by their greatest common divisor (GCD), and what's left is the ratio in simplest form. This guide walks the math from first principles, covers the awkward cases (decimal inputs, near-misses, very large primes), and shows how to do the same calculation in two clicks if you'd rather skip the arithmetic.

What you need (and what GCD actually means)

To calculate an aspect ratio from pixels you need exactly three things: the width in pixels, the height in pixels, and a way to find their greatest common divisor — the largest whole number that divides both without remainder.

The GCD is the engine of every aspect-ratio simplification. If two numbers share a common factor (like 1920 and 1080 both being divisible by 120), dividing both by that factor preserves their ratio while giving you smaller, more legible numbers. The aspect ratio of 1920 to 1080 is exactly the same as 16 to 9, which is exactly the same as 32 to 18. Mathematicians prefer the smallest pair because they're easier to compare, and 16:9 is what every TV and YouTube spec sheet uses.

For two integers a and b, the Euclidean algorithm finds the GCD in a small number of steps:

  1. If b is 0, return a.
  2. Otherwise, replace the pair (a, b) with (b, a mod b).
  3. Repeat.

Two facts make this fast: it terminates quickly (the second number shrinks at least by half every two iterations), and it doesn't care which of the two inputs is larger.

Step-by-step: 1920 × 1080 → 16:9

Let's run through it once with the most common screen resolution on Earth.

Step 1:  gcd(1920, 1080)
         = gcd(1080, 1920 mod 1080)
         = gcd(1080, 840)

Step 2:  gcd(1080, 840)
         = gcd(840, 1080 mod 840)
         = gcd(840, 240)

Step 3:  gcd(840, 240)
         = gcd(240, 840 mod 240)
         = gcd(240, 120)

Step 4:  gcd(240, 120)
         = gcd(120, 240 mod 120)
         = gcd(120, 0)
         = 120

So the GCD of 1920 and 1080 is 120. Divide each side:

1920 / 120 = 16
1080 / 120 = 9
→ 16:9

Done. Total: four arithmetic steps for a number every video editor types fifty times a week.

Step-by-step: 3840 × 2160 → still 16:9

4K UHD is just 1920 × 1080 doubled in each dimension. Doubling preserves aspect ratio, so the answer should still be 16:9 — and the math confirms it:

gcd(3840, 2160)
  = gcd(2160, 1680)  ← 3840 mod 2160 = 1680
  = gcd(1680, 480)   ← 2160 mod 1680 = 480
  = gcd(480, 240)    ← 1680 mod 480 = 240
  = gcd(240, 0)
  = 240

3840 / 240 = 16
2160 / 240 = 9
→ 16:9

This is a useful sanity check. Whenever you double, halve, or scale dimensions by a constant, the aspect ratio stays the same. If your simplification gives a different ratio after scaling, you made an arithmetic mistake.

Common dimensions and their ratios

A reference table for the resolutions you'll meet most often:

Resolution Pixels GCD Ratio Common name
HD Ready 1280 × 720 80 16:9 720p
Full HD 1920 × 1080 120 16:9 1080p
2K Cinema 2048 × 1080 32 256:135 DCI 2K
QHD 2560 × 1440 160 16:9 1440p
4K UHD 3840 × 2160 240 16:9 2160p
4K DCI 4096 × 2160 32 128:67* DCI 4K (≈1.91:1)
8K UHD 7680 × 4320 480 16:9 4320p
iPhone 15 Pro 1179 × 2556 3 393:852 ~9:19.5
Galaxy S24 Ultra 1440 × 3120 240 6:13 ~9:19.5
iPad Pro 13" 2752 × 2064 688 4:3 4:3

*DCI 4K's odd 128:67 simplification reflects that 4096 × 2160 is almost but not exactly 1.85:1, the dominant theatrical "flat" ratio. Cinema projectors letterbox or zoom to make this work.

Notice how modern phones produce nasty ratios. iPhone 15 Pro's 393:852 doesn't match any standard preset because Apple chose a slightly-taller-than-9:19.5 display for ergonomic reasons. When phones output ratios this exotic, you typically don't want the literal simplification — you want to compare against a near preset (the calculator's "closest preset" feature does this automatically).

Decimal inputs: cinema ratios

Cinema standards aren't whole numbers. A 2.39:1 anamorphic frame at 2048 × 858 pixels has a literal calculated ratio of 1024:429 — accurate but useless to anyone in the industry.

The trick is to scale the inputs up before the GCD step. Multiplying both 2.39 and 1 by 100 gives 239 and 100, and gcd(239, 100) = 1 (they're coprime), so 239:100 is the simplest form. Most calculators (this one included) scale by 10⁴ to capture four decimal places of precision — enough for 2.39:1, 1.85:1, 1.66:1, and even Ultra Panavision's 2.76:1.

For pixel inputs that came from a cinema crop, run the GCD as usual but expect a less recognizable answer than 16:9. Compare to the eight cinema and broadcast presets to see what your dimensions are closest to.

Edge cases worth knowing

Coprime inputs. If your width and height share no common factor (other than 1), the GCD is 1 and your "simplified" ratio is the original numbers, like 7:13. This usually means you've mis-typed a dimension; double-check your pixel counts.

Zero or negative inputs. Aspect ratio is undefined for non-positive dimensions. The calculator returns null on those inputs — don't try to interpret a gcd(0, n) result as a ratio.

Fractional pixels. Display pixels are always integers, but downscaled exports occasionally produce fractional pixel counts in EXIF metadata. Round to the nearest integer before calculating ratio, or accept the four-decimal precision bound (the difference between 1919.5 × 1080 and 1920 × 1080 is invisible).

Very large inputs. Even at 8K (7680 × 4320), the Euclidean algorithm runs in fewer than 10 iterations. There's no performance ceiling worth worrying about.

How to do this in one click

The math is straightforward but tedious for cases beyond the obvious. The free Screen Ruler aspect ratio calculator runs the GCD on whatever you type in the width and height fields, returns the simplified ratio, the closest preset name, the decimal value, and a visual aspect-ratio preview block — all instantly. The result-shareable URL means you can paste a configuration like ?w=1920&h=1080 straight into a Slack thread or design doc.

If you ever need to reverse the calculation — find a missing dimension when the ratio is fixed — the same calculator's reverse mode handles it: pick a preset (16:9, 9:16, 21:9, etc.), enter one known dimension, and read the other.

FAQ

What ratios are coprime? Two numbers are coprime when their GCD is 1, meaning they share no common factor besides 1. Examples: 7:13, 11:23, 393:852. Coprime ratios are valid but rarely correspond to a standard preset.

Why does my smartphone screen produce a weird ratio? Most modern phones (iPhone 14+, Galaxy S22+, Pixel 7+) use displays that are slightly taller than 9:19.5 to leave room for cameras and rounded corners. The exact ratio is intentional and not standardized — every phone is slightly different.

Is aspect ratio always an integer ratio? No. Cinema ratios like 2.39:1, 1.85:1, and 2.76:1 are decimal-to-1 ratios that don't simplify to small integers. The calculator preserves four decimals of precision; below that, rounding is acceptable.


Need this calculation in one click? The free Screen Ruler aspect ratio calculator handles eight presets and both directions of calculation. No signup, no ads, runs in your browser.

Related Articles