AyeCalc
All tools
Responsive layout

Aspect Ratio Calculator

Reduce any width and height to a reusable ratio and resize the dimensions proportionally. Use the result for images, video, cards, embeds, and responsive containers.

Simplified ratioProportional resizeCopy-ready CSS
Proportional sizing

Simplify and resize a ratio

Instant result

Simplified16:9width : height
Target height720px
Decimal1.777778width ÷ height
CSS declaration
aspect-ratio: 16 / 9;
Core formularatio = width ÷ height

For a target width: target height = target width × original height ÷ original width.

01
Method

How the aspect ratio calculator works

Reduce whole-number dimensions by their greatest common divisor. For decimal dimensions, normalize them before reduction. Preserve the original width-to-height quotient when calculating a new size.

Formularatio = width ÷ height

For a target width: target height = target width × original height ÷ original width.

02
Worked example

Simplify 1920 × 1080 and resize it to 1280px wide

Dividing both dimensions by their greatest common divisor, 120, produces 16:9. A proportional width of 1280px produces a height of 720px.

03
Implementation

Copyable code examples

Use these examples as a starting point, then match the values and assumptions to the rendered project.

CSS
.media {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
HTML
<img src="image.jpg" width="1920" height="1080" alt="">
04
Practical guidance

Using the result accurately

Use intrinsic media dimensions when available. Pair CSS aspect-ratio with a defined width or height and an appropriate object-fit rule for cropped media.

Important limitation

A matching container ratio does not guarantee uncropped content. object-fit, intrinsic media dimensions, borders, and layout constraints still affect rendering.

References: W3C CSS Sizing Level 4: preferred aspect ratios.

Common questions

Aspect Ratio Calculator FAQ

Answers about the method, assumptions, and practical use.

How do I calculate an aspect ratio?

Divide width and height by their greatest common divisor. For 1920×1080, divide both by 120 to get 16:9.

What is the difference between 16:9 and 1.7778?

They describe the same width-to-height relationship. 16:9 is the simplified pair, while 1.7778 is its approximate decimal quotient.

Can CSS aspect-ratio prevent layout shift?

It can reserve a predictable box when one dimension is known, but media should still include accurate intrinsic dimensions when possible.

Does object-fit change the aspect ratio?

It changes how replaced content fits inside its box. cover can crop content, while contain can leave unused space.