Understanding the CSS Aspect Ratio
An aspect ratio is the proportional relationship between an element's width and height, written as width:height (like 16:9) or as a single decimal (like 1.778). This calculator takes an original width and height, simplifies that ratio to its lowest whole-number terms, and — given a new width or height — computes the other dimension so the shape stays identical at any size.
The formulas
Three calculations do all the work:
- Simplified ratio: divide both the width and height by their greatest common divisor (GCD). For 1920×1080, the GCD is 120, so the ratio simplifies to 16:9.
- Decimal ratio: width ÷ height. 1920 ÷ 1080 = 1.778. This is the same number the CSS
aspect-ratioproperty represents internally. - Proportional scaling: to find a new height from a known new width, multiply the original height by the new width divided by the original width — new height = new width × (original height ÷ original width). To solve the other direction, swap width and height in the formula.
Common aspect ratios
- 16:9 — standard widescreen for HD/4K TVs, monitors, YouTube, most video content
- 4:3 — older TVs and monitors; still used in some photography and presentations
- 1:1 — square format; Instagram, profile photos
- 9:16 — vertical (portrait) video; Instagram Reels, TikTok, YouTube Shorts
- 21:9 — ultrawide monitor and cinematic format
Practical uses
- Calculating the height of an image given a fixed width (or vice versa) without distortion
- Cropping images to a target aspect ratio while maximizing pixel coverage
- Ensuring video content dimensions match platform requirements before upload
- Writing the CSS
aspect-ratioproperty so a container reserves the correct space before an image or video loads, preventing layout shift