Start a project

Tool 16 of 57 · Layout

Aspect Ratio Calculator

Find the ratio of any size, work out the missing width or height, and get the CSS to keep images, videos and cards in shape.

Aspect Ratio Calculator at a glanceIllustration: 1, Width and height; 2, processed in your browser; 3, Ratio + sizes.Aspect Ratio Calculator16px = 1rem1Width and height3Ratio + sizes2In yourbrowser
1 Width and height 2 processed on your device 3 Ratio + sizes

Aspect Ratio Calculator

Size and ratio

Type a ratio like 4:3 or 1.91:1, then change the width or height

Result

16:9

Sizes at this ratio and CSS

WidthHeightUse
CSS

01

What it does

Works out ratios and missing sides, lists common sizes at that ratio, and writes the CSS aspect-ratio code.

  • Ratio from any width and height
  • Lock the ratio and change one side
  • Presets from 1:1 to 21:9 and 1.91:1 share images
  • Common widths at the chosen ratio

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

CSS aspect-ratio and a size table, with a Copy and a Download button on every result.

  • 16:9
  • CSS
  • Images

Why it matters

Images and videos that load without a reserved shape make the page jump as they arrive. That jump is Cumulative Layout Shift, one of Google's Core Web Vitals. Giving every media box a fixed aspect ratio stops it.

Ratios also matter whenever you resize: a hero image at 1920 × 1080 needs to be 1280 × 720 at the next size down, and a social share image must be 1.91:1. This calculator does the maths and gives you the CSS.

How it works

  1. InputA width and height, or a ratio
  2. In your browserReduced by greatest common divisor
  3. OutputThe ratio, matching sizes and aspect-ratio CSS

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Sizing images, video and embeds during build.

By the numbers

Common aspect ratios as width ÷ height21:9: 2.333 : 1; 16:9: 1.778 : 1; 1.91:1: 1.91 : 1; 3:2: 1.5 : 1; 4:3: 1.333 : 1; 1:1: 1 : 1; 4:5: 0.8 : 1; 9:16: 0.562 : 1square21:92.333 : 116:91.778 : 11.91:11.91 : 13:21.5 : 14:31.333 : 11:11 : 14:50.8 : 19:160.562 : 1
Computed: width divided by height. Above 1 is landscape, below 1 is portrait. 16:9 is video, 1.91:1 is the Open Graph share image, 4:5 is a common portrait feed post and 9:16 is a story or reel. Source: Meta: image sizes.
Show the numbers as a table
RatioWidth ÷ height
21:92.333
16:91.778
1.91:11.91
3:21.5
4:31.333
1:11
4:50.8
9:160.562

How to use it

  1. Type a width and height, or pick a preset.
  2. Keep the lock on and change one side to work out the other.
  3. Check the list of common sizes at that ratio.
  4. Copy or download the CSS.

FAQ

What does CSS aspect-ratio do?

It sets a box's height from its width (or the other way round), so the space is reserved before the image or video loads. It's supported in every current browser.

Do I still need width and height on img tags?

Yes. Browsers use the width and height attributes to work out the ratio before the CSS loads. Add both, then set height: auto in CSS.

Why does 1366 × 768 not show as 16:9?

Because it isn't exactly: it reduces to 683:384. The calculator shows the exact ratio and the nearest common one.

What ratio do share images use?

1.91:1, which is 1200 × 630. Instagram posts work best at 4:5 and stories at 9:16.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk