Skip to content

Aspect ratio calculator

Enter a width and a height to get the aspect ratio: the calculator divides both by their greatest common divisor, so 1920 × 1080 is 16:9 and 1200 × 630 is 40:21. To resize, lock a ratio and type one side to get the other. You also get the nearest common ratio with the difference in percent, a preview of the shape, the CSS aspect-ratio, the Tailwind 4 class and the crop that puts an image at the ratio.

px
px
Type a ratio such as 16:9 or 1.91 to lock it, or pick one.
Aspect ratio

16:9

As a number

1.7778

This is 16:9: hd and 4k video, most monitors.

CSSaspect-ratio: 16 / 9;
Tailwind 4v3: aspect-[16/9]aspect-video
padding-topold browsers56.25%

The box is drawn at the exact ratio, fitted to this panel.

Resize an image to 16:9

Enter your image’s size to get the largest centred crop at this ratio, or the canvas it fits on without cropping.

px
px
Crop to

4000 × 2250

Cut 750 px of height: start at y = 375.

Or fit on a canvas of

5333 × 3000

1333 px of bars, left and right.

Width x height + left + top, the geometry ImageMagick’s -crop takes.

Common sizes and their real ratios

Sizes you will meet for video, social images and screens, run through the calculator. Several are known by a rounder name than they really have: 1366 × 768 is not quite 16:9, and neither ultrawide size is 21:9.

Used forSizeExact ratioNearest commonTailwind 4
Full HD video, YouTube1920 × 108016:916:9aspect-video
4K UHD video and TVs3840 × 216016:916:9aspect-video
DCI 4K cinema4096 × 2160256:1351.91:1 · 0.72% narroweraspect-256/135
Open Graph image (link previews)1200 × 63040:211.91:1 · 0.27% narroweraspect-40/21
Instagram square post1080 × 10801:11:1aspect-square
Instagram portrait post1080 × 13504:54:5aspect-4/5
Story, Reel, Short, TikTok1080 × 19209:169:16aspect-9/16
Pinterest pin1000 × 15002:32:3aspect-2/3
WUXGA monitor (16:10)1920 × 12008:516:10aspect-8/5
Ultrawide monitor, sold as 21:92560 × 108064:2721:9 · 1.59% wideraspect-64/27
Ultrawide monitor, sold as 21:93440 × 144043:1821:9 · 2.38% wideraspect-43/18
Laptop screen, sold as 16:91366 × 768683:38416:9 · 0.05% wideraspect-683/384
XGA, the first iPad1024 × 7684:34:3aspect-4/3
24-megapixel camera photo6000 × 40003:23:2aspect-3/2

Click a size to load it into the calculator.

Cropping a photo to a new ratio

A 4000 × 3000 photo is 4:3. To make it 16:9 without stretching it, keep the full width and cut the height to 4000 × 9 ÷ 16 = 2250 px: 750 px goes, 375 from the top and 375 from the bottom. To keep the whole photo instead, put it on a 5333 × 3000 canvas with 1333 px of bars at the sides.

In CSS you rarely crop the file. Give the image box the ratio and let object-fit: cover do the centred crop (Tailwind: aspect-video object-cover), or object-contain for the bars. Crop the file itself when it is shared outside your site, such as an Open Graph image; check that one with the Open Graph checker.

Image and video blocks with the ratios already set

5 of 88 free, no account. All of them in UI Pro.

  • Larchwood Joinery (gallery-04)01

    Larchwood Joinery

    gallery-04 · Free. Bespoke fitted furniture in Leeds.

    Open gallery-04
  • Hero (hero-01)02

    Hero

    hero-01 · Free. Journey-planner hero: from/to card with leave-at tabs, a day-out photo card and four quick-task tiles.

    Open hero-01
  • 03

    All free blocks

    Every one with a live preview, filtered to the ones you can use for free first.

    See them all

Questions

How do I calculate an aspect ratio?

Divide the width and the height by their greatest common divisor. For 1920 × 1080 that is 120, so the ratio is 1920 ÷ 120 : 1080 ÷ 120 = 16:9. Enter the two numbers above and the calculator does the division, gives the ratio as a single number (1.7778) and names the nearest common ratio when yours is not one.

How do I find the height for a width at a given ratio?

Multiply the width by the second number and divide by the first: height = width × 9 ÷ 16 for 16:9. A 1000 px wide 16:9 box is 562.5 px tall, which you round to 563. Turn on "Lock ratio" above, or pick a ratio, and type either side to get the other with the exact decimal.

What aspect ratio is 1200 × 630?

40:21, or 1.905:1. It is the size Facebook recommends for link preview images and is widely used for Open Graph images. It is often called 1.91:1, which it misses by 0.27%. Use the exact 1200 × 630 when you make the image.

How do I set an aspect ratio in CSS and Tailwind?

In CSS, aspect-ratio: 16 / 9 on the element, with a width; the height follows. In Tailwind CSS 4, aspect-video is 16:9 and aspect-square 1:1, and any whole-number ratio is a fraction class such as aspect-4/5. For decimals use an arbitrary value, aspect-[1.91/1], which also works in Tailwind 3. Every class the calculator writes is checked by compiling it with Tailwind 4.3.

Is a 21:9 ultrawide monitor really 21:9?

No. 2560 × 1080 is 64:27 (2.37:1) and 3440 × 1440 is 43:18 (2.39:1), while 21:9 is 2.33:1. 21:9 is a marketing name. The same goes for 1366 × 768 laptops, which are 683:384, 0.05% wider than 16:9.

What is the padding-top trick, and do I still need it?

Before the aspect-ratio property, a box kept its shape with padding-top set to height ÷ width as a percentage, 56.25% for 16:9, because padding percentages are taken from the width. aspect-ratio has worked in Chrome since version 88, Firefox 89 and Safari 15, all from 2021, so you only need the padding value for older browsers.

Is it free?

Yes. No sign-up, no ads, and the sums run in your browser. The address bar holds the width and height, so you can share a link to a size.

UI Pro

Build your next site from finished blocks

Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.

blocks
1401
page templates
55
website themes
29
The About page template from UI Pro, built from its blocks.

This card is a UI Pro block: Rooilijn (call-to-action-07).