Aspect Ratio Calculator
Simplify image and video dimensions to an exact aspect ratio, generate CSS aspect-ratio and calculate a proportional height.
How to use
The greatest common divisor reduces integer dimensions to an exact ratio: 1920 × 1080 becomes 16:9, while 1080 × 1920 becomes 9:16. The result also includes an aspect-ratio CSS declaration.
Enter an optional new width to calculate height = new width × original height / original width. The calculated height is rounded to three decimal places; image editors may require rounding again to a whole pixel.
Behavior and limits
This calculator does not resize, crop or upload an image. It works from dimensions only. Use positive integer dimensions up to one billion; zero and fractional source sizes are rejected.
Questions & answers
Why is a near-16:9 size not shown as 16:9?
The tool reports the exact ratio instead of snapping to a named preset. Cropped or rounded dimensions can have a different exact ratio.
Is my input uploaded?
No. Processing runs in your browser. This tool does not send your input to an API or save it in local storage. Text tools accept up to 200,000 characters.
Other Languages
References
How we make sure
We check this tool with the automated test suites linked below. Example checks are shown in their original language.
- Verification method
- Check reduced ratios and target dimensions, such as 1920×1080 → 16:9 → 1280×720.
- Comparison reference
- Explicit integer-ratio and proportional-scaling expectations.
- Verification scope
- These samples and boundaries do not prove correctness for every input.
Test source and cases (select a file to read it)
-
workbench.test.js
- aspect ratios are exact and calculated heights are proportional
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.