
Image aspect ratio
Calculate image aspect ratio using the values and assumptions you provide.
Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.
Method and assumptions
Method version 1.0.0 · Updated
Calculate
Formula: Width:height, reduced by the GCD
Calculate image aspect ratio using the values and assumptions you provide.
- width
- Width (m)
- height
- Height (cm)
Results depend on the assumptions entered; verify professional or safety-critical decisions independently.
Calculate with code
These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.
JavaScript
const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
const width = 1920, height = 1080, divisor = gcd(width, height);
console.log(`${width / divisor}:${height / divisor}`); // 16:9TypeScript
const gcd = (a: number, b: number): number => b === 0 ? a : gcd(b, a % b);
const width = 1920, height = 1080, divisor = gcd(width, height);
console.log(`${width / divisor}:${height / divisor}`); // 16:9Python
from math import gcd
w, h = 1920, 1080
g = gcd(w, h)
print(f"{w // g}:{h // g}") # 16:9Java
int w = 1920, h = 1080;
int g = java.math.BigInteger.valueOf(w).gcd(java.math.BigInteger.valueOf(h)).intValue();
System.out.println((w / g) + ":" + (h / g)); // 16:9C#
int w = 1920, h = 1080;
int g = (int)System.Numerics.BigInteger.GreatestCommonDivisor(w, h);
Console.WriteLine($"{w / g}:{h / g}"); // 16:9