Free tool

Aspect ratio calculator

Enter a width and height to get the aspect ratio (1920×1080 is 16:9), then type a new width or height to get the other side at the same ratio. Pick a preset, paste a size like 1366x768, or type a ratio like 2.39:1 directly.

Free · no sign-up · runs in your browser, nothing is uploaded

Size → ratio

Aspect ratio

16:9

landscape · 1080p Full HD

Decimal (w ÷ h)

1.7778

1.78:1

Closest common ratio

16:9

exact match

Height as % of width

56.25%

padding-top hack value

1920 × 1080 · 2,073,600 px (2.07 MP)

Resize at 16:9

1280 × 720

Whole-pixel sizes at exactly 16:9, nearest 1280px wide

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

/* Images and video: crop to fill the box */
.box img,
.box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

How the calculation works

An aspect ratio is width divided by height, written as two whole numbers. To reduce a size, find the greatest common divisor (GCD) of the two sides and divide both by it. To scale a size, keep the ratio and solve for the missing side.

ratio        = width ÷ gcd(width, height) : height ÷ gcd(width, height)
1920 × 1080  → gcd 120 → 16:9

new height   = new width × ratio height ÷ ratio width
1280 at 16:9 → 1280 × 9 ÷ 16 = 720

new width    = new height × ratio width ÷ ratio height
1920 at 9:16 → 1920 × 9 ÷ 16 = 1080

The same in JavaScript:

const gcd = (a, b) => (b ? gcd(b, a % b) : a);
const ratio = (w, h) => { const g = gcd(w, h); return `${w / g}:${h / g}`; };
ratio(1920, 1080);          // "16:9"
const heightFor = (w, rw, rh) => (w * rh) / rw;
heightFor(1280, 16, 9);     // 720

When the new side comes out as a fraction (1080 wide at 16:9 is 607.5 tall), the tool lists nearby sizes where both sides are whole pixels at exactly that ratio. Turn on "even numbers only" for video: H.264 and most other encoders with 4:2:0 chroma need even widths and heights.

Common aspect ratios and where they are used

RatioDecimalTypical sizeUsed for
16:91.781920×1080HD and 4K video, YouTube, most monitors and TVs
9:160.561080×1920Vertical video: Reels, TikTok, Shorts, Stories
4:31.331024×768Older TVs and monitors, iPad screens, many slides
3:21.501500×1000Full-frame and APS-C camera photos, Surface laptops
1:11.001080×1080Square posts, avatars, album covers
4:50.801080×1350Portrait feed posts
16:101.601920×1200Laptop screens (1920×1200, 2560×1600)
21:92.372560×1080Ultrawide monitors (2560×1080 is exactly 64:27)
2:12.001200×600Open Graph share images are close (1200×630 is 40:21)
5:41.251280×10241280×1024 monitors, 8×10 prints
2:30.671000×1500Portrait photos, posters, Pinterest pins (1000×1500)
32:93.565120×1440Super-ultrawide monitors (5120×1440)
1.85:11.851998×1080Widescreen cinema (flat)
2.39:12.392048×858Anamorphic cinema (scope)

Screen and video resolutions with their exact ratio

Marketing names round. The exact reduced ratio tells you whether two sizes really scale into each other without cropping.

NameSizeExact ratioDecimal
720p HD1280×72016:91.78:1
1080p Full HD1920×108016:91.78:1
1440p QHD2560×144016:91.78:1
4K UHD3840×216016:91.78:1
8K UHD7680×432016:91.78:1
DCI 4K (cinema)4096×2160256:1351.9:1
Common laptop1366×768683:384 (sold as 16:9)1.78:1
WUXGA1920×12008:51.6:1
WQXGA2560×16008:51.6:1
XGA1024×7684:31.33:1
UXGA1600×12004:31.33:1
SXGA1280×10245:41.25:1
Ultrawide FHD2560×108064:27 (sold as 21:9)2.37:1
Ultrawide QHD3440×144043:18 (sold as 21:9)2.39:1
Vertical video1080×19209:161:1.78
Square1080×10801:11:1
Portrait post1080×13504:51:1.25
Open Graph image1200×63040:211.9:1

Aspect ratio in CSS, HTML and Tailwind

The aspect-ratio property has been supported in all major browsers since 2021. Set one side and the browser computes the other:

.video {
  width: 100%;
  aspect-ratio: 16 / 9;   /* "16 / 9", or a single number like 1.7778 */
}
.video iframe { width: 100%; height: 100%; }

/* Images: crop to the box instead of stretching */
.thumb { aspect-ratio: 1; object-fit: cover; width: 100%; }
  • At least one of width or height must be automatic. If you set both, aspect-ratio does nothing.
  • aspect-ratio: auto 16 / 9 uses an image's own ratio once it loads, and 16:9 until then.
  • On <img> and <video>, the width and height attributes give the browser the ratio before the file loads, so the page does not jump (layout shift). Set them to the file's real size, then size the element with CSS.
  • Before 2021 the trick was height: 0; padding-top: 56.25% (9 ÷ 16), because vertical padding in percent is relative to the width. The tool's "Old browsers" tab writes it for any ratio.
  • Media queries can test the viewport: @media (min-aspect-ratio: 16/9) matches screens that are 16:9 or wider.
  • Tailwind has aspect-video (16 / 9), aspect-square (1 / 1) and arbitrary values like aspect-[4/3].

Sizing images for the web? Convert them with the image converter, render SVGs at an exact size with SVG to PNG, or turn pixel sizes into rem with the PX to REM converter. More on design tools on DevHunt.

FAQ

How do I calculate an aspect ratio?+

Divide the width and the height by their greatest common divisor. For 1920×1080 the divisor is 120, so the ratio is 16:9. For 1366×768 it is 2, which gives 683:384: close to 16:9 but not exact.

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

height = width × ratio height ÷ ratio width. For 16:9 at 1280 wide: 1280 × 9 ÷ 16 = 720. For the width from a height, swap them: width = height × ratio width ÷ ratio height.

What is a 16:9 resolution?+

Any size whose width divided by its height is 1.7778: 1280×720 (720p), 1920×1080 (1080p), 2560×1440 (1440p) and 3840×2160 (4K UHD) are the common ones. It is the standard ratio for HD video and most monitors and TVs.

What is the aspect ratio of 1080×1350?+

4:5, a portrait ratio (1080 and 1350 share a divisor of 270). It is a common size for portrait posts in social feeds.

Is 21:9 really 21:9?+

Not exactly. Ultrawide monitors sold as 21:9 are usually 2560×1080 (64:27, about 2.37:1) or 3440×1440 (43:18, about 2.39:1). 21:9 itself is 2.33:1. The calculator shows the exact ratio and the closest marketing name.

How do I keep an aspect ratio in CSS?+

Give the element a width and set aspect-ratio: 16 / 9; the browser computes the height. Leave either width or height automatic, or the ratio has no effect. For images and video inside the box, add object-fit: cover to crop instead of stretching.

What does 2.39:1 or 1.85:1 mean?+

Those are ratios written against a height of 1, common in cinema: 1.85:1 is the usual widescreen format and 2.39:1 the anamorphic scope format. Type 2.39:1 or just 2.39 in the ratio field to work with them.

Sources: MDN: aspect-ratio · CSS Box Sizing 4: aspect-ratio · MDN: object-fit · MDN: aspect-ratio media feature · HTML spec: img width and height map to aspect-ratio · web.dev: Optimize Cumulative Layout Shift · Tailwind CSS: aspect-ratio. Checked 2026-10-30.