Calculate ratio

Reduce two numeric parts to the simplest whole-number ratio while preserving their proportion.

freeworks offlinenothing uploaded
ToolRatio Calculator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Components are parsed as numbers, decimal places are scaled to a common integer factor, and the greatest common divisor divides every component. Reduced parts retain original order and proportion.

  • Two components are expected because the common use is an a:b comparison.
  • Decimal scaling preserves finite decimal input before integer reduction.

Worked example

Simplify Screen Ratio
Simplify a 1920:1080 screen resolution ratio
Input
											1920:1080
										
Output
												16:9
											

When to use this

Screen designs compare 16:9, recipes scale ingredient parts, and mixture plans reduce measured quantities to whole parts.

Edge cases

  • 1.5:2 scales to 3:4 instead of rounding components independently.
  • A ratio containing zero is rejected by this implementation when the common divisor is zero.
  • Long repeating decimal strings are subject to JavaScript number precision before reduction.