Aspect ratio calculator

Aspect Ratio Calculator

Pick a ratio and enter a width or height to get the other side. Enter a resolution to find its ratio.

Ratio

Know the width? Get the height

px

Know the height? Get the width

px

Find the ratio of a resolution or image

Preview and CSS

One line of aspect-ratio is all you need. Use the padding-top hack only for very old browsers.

16:9
.box {
  aspect-ratio: 16 / 9;
}

Common aspect ratios

RatioWidth ÷ heightpadding-topTypical useExample sizes
9:160.563177.78%Shorts, Reels and Stories, phones in portrait1080×1920
4:50.8125%Instagram portrait posts1080×1350
1:11100%Square thumbnails, avatars, Instagram posts1080×1080
4:31.33375%iPad, phone camera photos, older monitors1024×768, 4032×3024
3:21.566.67%DSLR and mirrorless photos, Surface laptops6000×4000, 2880×1920
16:101.662.5%MacBooks and other laptops1440×900, 2560×1600
16:91.77856.25%YouTube video, Full HD and 4K monitors and TVs1920×1080, 3840×2160
1.91:11.90552.5%Link preview (Open Graph) images1200×630
21:92.33342.86%Ultrawide monitors, cinema footage2560×1080, 3440×1440

21:9 is a product category name. Real ultrawide monitors are 64:27 at 2560×1080 (about 2.37:1) and 43:18 at 3440×1440 (about 2.39:1).

Height chart by width

The height that matches each ratio for common widths, in px, rounded to one decimal place.

Width16:94:33:216:1021:9
320180240213.3200137.1
360202.5270240225154.3
375210.9281.3250234.4160.7
390219.4292.5260243.8167.1
480270360320300205.7
640360480426.7400274.3
720405540480450308.6
768432576512480329.1
800450600533.3500342.9
1024576768682.7640438.9
1280720960853.3800548.6
1366768.41024.5910.7853.8585.4
14408101080960900617.1
160090012001066.71000685.7
19201080144012801200822.9
2560144019201706.716001097.1
384021602880256024001645.7

How to use CSS aspect-ratio

aspect-ratio locks the proportion between an element's width and height. Set the width and the height follows the ratio automatically.

.video {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
  • One side must be auto. If you set both width and height, aspect-ratio is ignored.
  • Content can stretch the box. If the text overflows, the box grows taller than the ratio. Add min-height: 0 or overflow: hidden to enforce it.
  • Pair images and video with object-fit. Forcing a different ratio distorts them, so set cover (crop to fill) or contain (show everything).
  • Keep width and height attributes on img. The browser uses them to reserve space at the right ratio before the image loads, which reduces layout shift (CLS).
  • Browser support: Chrome and Edge 88, Firefox 89 and Safari 15 (2021), so every current browser supports it.

Frequently asked questions

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

Height = width × 9 ÷ 16, so 1280 × 9 ÷ 16 = 720px. If you know the height instead, width = height × 16 ÷ 9. Type the width into the Width → Height box above to get it instantly.

How do I find the aspect ratio of a resolution?

Divide the width and height by their greatest common divisor. 1920×1080 divided by 120 is 16:9. Some resolutions such as 1366×768 reduce to an odd ratio (683:384), but at 1.779:1 they are close enough to 16:9 (1.778:1) that everyone calls them 16:9.

Where does padding-top: 56.25% come from?

It is height ÷ width × 100 for 16:9, so 9 ÷ 16 × 100 = 56.25%. Percentage padding is calculated from the parent's width, so a zero-height box with padding-top gets a height proportional to its width. 4:3 is 75% and 1:1 is 100%.

Should I use aspect-ratio or the padding-top hack?

Use aspect-ratio. Chrome, Edge, Firefox and Safari have all supported it since 2021, it is a single line, and you no longer need to absolutely position the content. The padding-top hack is only needed for very old browsers such as Internet Explorer.

What is the real ratio of a 21:9 monitor?

21:9 is more of a product category than an exact ratio. 2560×1080 is 64:27 (about 2.37:1) and 3440×1440 is 43:18 (about 2.39:1), while true 21:9 is 2.33:1. If you need to match a real screen, calculate the ratio from its resolution.

Related tools