# Aspect Ratio Calculator

> Type a width and a height to get the simplest ratio and its common name, work out the missing side for a new size, see how much object-fit: cover cuts, and copy the CSS.

- Page: https://codethatmoves.com/tools/images/aspect-ratio-calculator/
- Site: Code That Moves
- Category: Images and files
- Free, runs in the browser, nothing is uploaded
- Last checked: 2026-11-03

## What it does

- Simplest whole-number ratio for any size, e.g. 1920×1080 is 16:9
- Decimal ratio, orientation, megapixels and the common name within 2 %
- Fourteen presets, from 16:9, 16:10, 9:16, 4:3, 5:4, 3:2, 1:1 and 4:5 to 1.91:1, 2:1, 21:9, 2.39:1, 3:1 and 32:9
- Type a ratio such as 16:9 or 2.39:1 directly; the height follows the current width
- A preset that flips the orientation keeps the long side, so 1920×1080 at 9:16 becomes 1080×1920
- Missing side for a new width or height, flagged when it has to be rounded
- How much object-fit: cover cuts, or contain leaves empty, in a frame of another ratio
- CSS aspect-ratio and the old padding-top value, a table of common widths and a share link

## How to use it

1. Type the width and height of your image, video or screen, type a ratio, or pick a preset. The ratio and its common name appear at once.
2. Under Resize, type a new width or a new height. The other side follows at the same ratio, and the tool says if it had to round.
3. Pick a frame ratio to see what happens when the image fills a box of another shape, then copy the CSS or the share link.

## What it checks and why

An aspect ratio is width divided by height, written as two whole numbers. Divide both sides by their greatest common divisor and you get the simplest form: 1920 and 1080 share 120, so 1920×1080 is 16:9. 1080×1350 reduces to 4:5, the tall feed format, and 1080×1920 to 9:16.

Some sizes have a common name that is not their exact ratio. 1200×630, the usual Open Graph image, reduces to 40:21, but everyone calls it 1.91:1. The tool shows the exact ratio and, when a common ratio is within 2 %, its name too. Ultrawide 2560×1080 is really 64:27, but it is sold as 21:9.

Resizing at a ratio only stays exact when the new width is a multiple of the ratio's width. 16:9 at 1000 px wide is 562.5 px tall, which has to be rounded, and the picture is then 0.09 % off. The table lists common widths and marks which ones divide evenly.

When an image goes into a box of a different shape, CSS object-fit decides what happens. cover fills the box and cuts the overflow; contain shows everything and leaves bars. The share that cover cuts is the same as the share contain leaves empty: a 16:9 video in a 9:16 frame loses about 68 % to either. For responsive boxes, the aspect-ratio property replaced the old padding-top percentage trick, which the tool still writes for old code.

## Specs and sources

- [MDN: aspect-ratio](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio)
- [MDN: object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit)
- [CSS Box Sizing Module Level 4: aspect-ratio](https://www.w3.org/TR/css-sizing-4/#aspect-ratio)

## Limits

- Sizes are in pixels. Decimal sizes are accepted (to four places) but show the decimal ratio only; the simplest whole-number ratio needs whole numbers.
- The crop figures assume the image is centred, as object-position: center does by default.
- The common names are the usual ones for screens, video and social posts; a platform may change its recommended size, so check its help page before you export.
- Pixel aspect ratio of old video formats (non-square pixels) is not taken into account.

## Questions

### How do I calculate an aspect ratio?

Divide the width and the height by their greatest common divisor. 1920 and 1080 are both divisible by 120, which gives 16 and 9, so the ratio is 16:9.

### What is the height of a 16:9 image that is 1280 wide?

Multiply the width by 9 and divide by 16, which gives 720. Type the width under Resize and the tool works out the height for any ratio.

### Is 1080×1350 4:5?

Yes. Both numbers divide by 270, giving 4 and 5. It is the tall portrait size that takes the most room in an Instagram feed.

### What ratio is 1200×630?

Exactly 40:21, which is 1.905 to 1. It is usually called 1.91:1 and is the common size for Open Graph link preview images.

### How do I keep an aspect ratio in CSS?

Give the element a width and aspect-ratio: 16 / 9, and the browser works out the height. Copy the line from the tool; it also gives the old padding-top value for code that still uses it.

### How much does object-fit: cover crop?

It depends on how different the two shapes are. Pick a frame ratio in the tool to see the percentage that is cut and from which sides.
