How to Calculate Aspect Ratio and Resize Without Distortion
Learn how to calculate aspect ratio from a width and height, resize without distortion and use the CSS aspect-ratio rule. Checked in Python and Chromium.
By TheTextKit TeamPublished

A table of three results for the aspect ratio calculator. 30,000 random sizes were checked against Python. There were no wrong ratios. 3,000 of them were also checked in Chromium.
To calculate aspect ratio, divide the width and the height by their greatest common divisor. For 1920 x 1080 that divisor is 120, so the ratio is 1920 / 120 : 1080 / 120, which is 16:9. If you want a single number, divide the width by the height: 1.78. With the ratio you can resize an image or a video to any width and get the right height. You can also tell a browser to keep a box in proportion with one line of CSS. This guide shows the steps, the common ratios, and how we checked our aspect ratio calculator against Python and Chromium.
How to calculate aspect ratio
- Write down the width and the height in the same unit, for example pixels.
- Find their greatest common divisor, the largest whole number that divides both.
- Divide the width and the height by it. The two results are the ratio.
- For the decimal form, divide the width by the height.
| Size | Ratio | Decimal |
|---|---|---|
| 1920 x 1080 | 16:9 | 1.78 |
| 1280 x 1024 | 5:4 | 1.25 |
| 1200 x 630 | 40:21 | 1.90 |
| 1366 x 768 | 683:384 | 1.78 |

A table of four sizes and their aspect ratios in lowest terms. 1920 x 1080 is 16:9. 1280 x 1024 is 5:4. 1200 x 630 is 40:21. 1366 x 768 is 683:384.
The last two rows do not reduce to a name you have heard. That is normal. The ratio of 1200 x 630 in lowest terms is 40:21, which is close to the 1.91:1 that people quote for link preview images. And 1366 x 768 is 683:384, which is close to 16:9. The calculator shows both the exact ratio and the nearest common one, when it is within 1%. For 1366 x 768 that is 16:9, about 0.05% off.
You will also see ratios written as a decimal. The Wikipedia article on aspect ratios notes that the cinema convention gives the height a value of 1 and writes the width as a decimal. So 16:9 is also written 1.78:1, and such decimals are often rounded.
How to resize and keep the aspect ratio
To keep the ratio when you resize, you need the other side to scale by the same factor. If you know the new width, the new height is the new width times the original height, divided by the original width. If you know the new height, swap the roles.
Take a 1920 x 1080 image and scale it to 1280 wide: 1280 x 1080 / 1920 = 720. The result is 1280 x 720, still 16:9.
Often the answer is not a whole number. A 1000 pixel wide 16:9 image should be 1000 x 1080 / 1920 = 562.5 pixels tall. Pixels are whole, so you round, and the calculator rounds halves up to 563. That changes the ratio by less than a tenth of a percent (1000 / 563 is 1.776, against 1.778), which no one will see. The calculator shows both the exact value and the rounded one, so you can decide.
| Original | New width | Calculation | New height |
|---|---|---|---|
| 1920 x 1080 | 1280 | 1280 x 1080 / 1920 | 720 |
| 1920 x 1080 | 1000 | 1000 x 1080 / 1920 | 562.5, rounded to 563 |
| 4:3 | 800 | 800 x 3 / 4 | 600 |

A table with the three parts of one resize. The original size is 1920 x 1080. The formula is 1280 x 1080 / 1920. The new height is 720, so the new size is 1280 x 720.
Common aspect ratios and where they are used
According to the Wikipedia article above, 16:9 is the international standard format of HDTV, and it became mainstream for computer monitors after 2010. 4:3 was the standard for television before that. Classic 35 mm still cameras use 3:2, the 1:1 square ratio is common on social platforms, and 21:9 is an ultrawide format popular for gaming monitors.
| Ratio | Decimal | Where you see it |
|---|---|---|
| 16:9 | 1.78 | HDTV and most monitors |
| 4:3 | 1.33 | Older television |
| 3:2 | 1.5 | 35 mm still cameras |
| 1:1 | 1 | Square images |
| 21:9 | 2.33 | Ultrawide monitors |
| 1.91:1 | 1.91 | Link preview images |

A table of four common aspect ratios with their decimal value and a typical use. 16:9 is 1.78 and is used for HDTV. 4:3 is 1.33 and is used for standard television. 3:2 is 1.5 and is used for 35 mm film. 1:1 is 1 and is used for square images.
Many ultrawide monitors sold as 21:9 are really 64:27, which is 2.37. The calculator names 2560 x 1080 as 21:9 for that reason, though the exact ratio is 64:27.
Link preview images and the 1.91:1 ratio
When you share a link, Facebook shows a preview image. Its sharing documentation recommends images of at least 1200 x 630 pixels and an aspect ratio as close to 1.91:1 as possible, so that they show in the feed without cropping. It gives 600 x 315 pixels as the smallest size that still gets the large preview, and 8 MB as the largest file. To calculate aspect ratio for that size, divide: 1200 / 630 is 1.905, which is the practical match. If you build these tags yourself, the Open Graph Generator writes them.
The CSS aspect-ratio property and the padding trick
In CSS you do not have to calculate the height at all. The MDN page on aspect-ratio says the property defines the desired width to height ratio of a box, written as width / height, and that the browser keeps it when the container changes size. Write aspect-ratio: 16 / 9; on a box 800px wide and it becomes 450px tall. MDN adds a condition: at least one of the box's sizes must be automatic, or the ratio has no effect.
The older way is the padding trick. Padding given as a percentage is relative to the width of the containing block. So an element that fills its container and has padding-top: 56.25% is 56.25% as tall as it is wide, which is 9 / 16. For 4:3 it is 75%. The calculator prints both, so you can copy the one you need.
How we tested the calculator
A script generated 30,000 random sizes, whole numbers and decimals with up to six decimals, from single digits to nine digits. For each, Python's exact Fraction and Decimal types gave the ratio in lowest terms, the decimal ratio and the padding percentage. They also gave the resized height and width, exact and rounded, and the nearest common name. We compared every one with the calculator.
For 3,000 of the sizes, those with whole pixel widths and ratios between 1:10 and 10:1, we also asked Chromium. We built a box with the width and the aspect-ratio rule the calculator printed, and another with the padding percentage it printed, and measured both heights. Chromium lays out boxes in steps of 1/64 of a pixel and rounds down to the step, so we allowed that much difference.
| Check | Sizes | Mismatches |
|---|---|---|
| Ratio and decimal against Python | 30,000 | 0 |
| Resized height and width against Python | 30,000 | 0 |
| Padding percentage against Python | 30,000 | 0 |
| CSS rule and padding trick against Chromium | 3,000 | 0 |

A table of four tests of the aspect ratio calculator. 30,000 sizes were checked against Python for the ratio and decimal, for the resized height and width, and for the padding percentage. 3,000 sizes were checked against Chromium for the CSS rule and the padding trick. There were 0 mismatches.
Our first Chromium run reported 390 mismatches, and the second 46. None were errors in the calculator. A width with decimals such as 188.924485px is snapped by the browser to 1/64 of a pixel before it works out the height. A ratio with numbers over a million, which comes from a size with many decimals, drifted by a few hundredths of a pixel in the browser's own arithmetic. For very tall, thin boxes it drifted more.
We then limited the test to whole pixel widths and ratios between 1:10 and 10:1, and allowed 0.05px for the ratios with numbers over a million. With those limits the heights agreed in all 3,000 cases.
Limits
When you calculate aspect ratio with this tool, it reads positive sizes with at most six decimals and nine digits before the point. It names a common ratio only within 1%, so an unusual size such as 1000 x 300 has no name, which is correct. Rounding to whole pixels is your decision: the tool shows the exact value so you can see the error you accept.
Frequently asked questions
How do you calculate an aspect ratio?
Divide the width and the height by their greatest common divisor. For 1920 x 1080 the greatest common divisor is 120, so the ratio is 16:9. For the decimal form, divide the width by the height: 1920 / 1080 is about 1.78.
How do I resize an image and keep the aspect ratio?
Multiply the new width by the original height and divide by the original width to get the new height. For a 1920 x 1080 image scaled to 1280 wide, 1280 x 1080 / 1920 is 720. Round to a whole number of pixels.
What is the aspect ratio of 1366 x 768?
It is exactly 683:384, which is about 16:9. The size is a few pixels off true 16:9 because 768 is not divisible by 9, so the exact ratio does not reduce to 16:9.
What does the CSS aspect-ratio property do?
It sets the width to height ratio of a box, so the browser works out the height from the width. With aspect-ratio: 16 / 9, a box 800px wide becomes 450px tall. It only has an effect when the width or the height is set to auto.
What size should an Open Graph image be?
Facebook's documentation recommends images of at least 1200 x 630 pixels and an aspect ratio close to 1.91:1. The smallest size that still gets the large preview is 600 x 315 pixels.
Calculate your aspect ratio now
Enter a width and a height into the Aspect Ratio Calculator to calculate aspect ratio, get the nearest common name, resize with the ratio locked, and copy the CSS. For sizes in rem and em, use the PX to REM Converter. To crop to a ratio, add bars around a picture or list video sizes for it, try the Crop to Aspect Ratio Calculator, the Letterbox Calculator and the Video Resolution Calculator. Everything runs in your browser, so nothing you type is uploaded.


