Ratios and proportions

Simplify a positive integer ratio and find a proportional quantity.

Changing modes clears your inputs and result.

Enter two strictly positive integer parts. The resulting ratio is reduced. Example: 1920:1080 = 16:9. For signed or zero fractions, use the fraction calculator.

Your inputs stay in your browser.

Method and assumptions

Method version 1.0.0 · Updated

Simplify a ratio

Formula: A:B → (A ÷ GCD):(B ÷ GCD)

Enter two strictly positive integer parts. The resulting ratio is reduced. Example: 1920:1080 = 16:9. For signed or zero fractions, use the fraction calculator.

a
First part (A)
b
Second part (B)
Find a proportional quantity

Formula: D = C × B / A

A:B = C:D. The new quantity C can be decimal or zero. Keep the same unit for A and C, and for B and D. Example: ratio 16:9 and C = 32 → D = 18. This is a direct proportion, without rounding to a whole quantity.

a
First part (A)
b
Second part (B)
c
New first quantity (C)

Parts A and B are strictly positive integers, limited to 9,007,199,254,740,991. Exact simplification; proportional quantity displayed with at most 12 significant digits.

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 a = 16, b = 9;
const gcd = (x, y) => y === 0 ? x : gcd(y, x % y);
const d = gcd(a, b);
console.log(`${a / d}:${b / d}`); // 16:9
TypeScript
const a = 16, b = 9;
const gcd = (x: number, y: number): number => y === 0 ? x : gcd(y, x % y);
const d = gcd(a, b);
console.log(`${a / d}:${b / d}`); // 16:9
Python
from math import gcd
a, b = 16, 9
g = gcd(a, b)
print(f"{a // g}:{b // g}")  # 16:9
Java
int a = 16, b = 9;
int g = java.math.BigInteger.valueOf(a).gcd(java.math.BigInteger.valueOf(b)).intValue();
System.out.println((a / g) + ":" + (b / g)); // 16:9
C#
int a = 16, b = 9;
int g = (int)System.Numerics.BigInteger.GreatestCommonDivisor(a, b);
Console.WriteLine($"{a / g}:{b / g}"); // 16:9