Aspect Ratio Calculator & Image Ratio Guide: How to Calculate & Check Image Aspect Ratio (16:9, 4:3, 1:1)
Learn how to calculate the aspect ratio of any image using the GCD formula, check image ratios online, resize width and height proportionally without distortion, and prevent CSS layout shifts.
Whether you are cropping a hero banner for a responsive website, exporting a 16:9 YouTube thumbnail, checking the aspect ratio of an image from a DSLR camera, or preventing Cumulative Layout Shift (CLS) in CSS, understanding how to calculate aspect ratio and scale pixel dimensions proportionally is a core skill for designers and developers.
Use the interactive Aspect Ratio Calculator widget embedded below—or open the full Image Aspect Ratio Calculator & Ratio Checker—to compute ratios, inspect local image files, and resize dimensions without stretching.
1. What Is an Image Aspect Ratio?
An aspect ratio (or image ratio) describes the proportional relationship between an image's width and its height, expressed as two numbers separated by a colon (W:H) or as a decimal quotient (W ÷ H).
- Aspect Ratio is Independent of Total Resolution: A
1280 × 720HD thumbnail, a1920 × 1080Full HD frame, and a3840 × 21604K Ultra HD frame all share the exact same 16:9 aspect ratio (1.7778:1) because for every 16 units of horizontal width, there are 9 units of vertical height. - Orientation Classification: When
Width > Height(such as16:9or3:2), the image is Landscape. WhenHeight > Width(such as9:16or4:5), the image is Portrait. WhenWidth = Height(1:1), the image is Square.
2. How to Calculate Aspect Ratio from Width and Height (GCD Formula)
To calculate the aspect ratio of an image from its pixel width (W) and height (H), divide both numbers by their Greatest Common Divisor (GCD) using Euclid's algorithm:
// Euclidean Algorithm to find Greatest Common Divisor (GCD)
function getGCD(a: number, b: number): number {
return b === 0 ? a : getGCD(b, a % b);
}
function calculateAspectRatio(width: number, height: number) {
const divisor = getGCD(width, height);
const ratioW = width / divisor;
const ratioH = height / divisor;
return {
simplifiedRatio: `${ratioW}:${ratioH}`,
decimalRatio: (width / height).toFixed(4)
};
}
// Worked Example 1: 1920 × 1080 px
// GCD(1920, 1080) = 120 --> (1920 / 120) : (1080 / 120) = 16:9 (1.7778:1)
// Worked Example 2: 1080 × 1350 px (Instagram Portrait)
// GCD(1080, 1350) = 270 --> (1080 / 270) : (1350 / 270) = 4:5 (0.8000:1)
3. Standard Image, Video & Photography Aspect Ratios Reference Table
| Aspect Ratio | Decimal (W÷H) | Common Pixel Dimensions | Primary Industry Use Cases |
|---|---|---|---|
| 16:9 | 1.7778:1 | 1280×720, 1920×1080, 2560×1440, 3840×2160 | HD/4K video, YouTube thumbnails, monitors, web hero banners |
| 9:16 | 0.5625:1 | 720×1280, 1080×1920, 2160×3840 | TikTok, Instagram Reels, YouTube Shorts, mobile stories |
| 4:5 | 0.8000:1 | 1080×1350, 1200×1500, 2400×3000 | Instagram & LinkedIn vertical portrait feed posts, 8×10" prints |
| 1:1 | 1.0000:1 | 600×600, 1080×1080, 1200×1200, 2000×2000 | E-commerce product cards, profile avatars, US passport photos |
| 4:3 | 1.3333:1 | 1024×768, 1600×1200, 2048×1536, 4032×3024 | Smartphone camera sensors, Micro Four Thirds cameras, iPads |
| 3:2 | 1.5000:1 | 1200×800, 1800×1200, 6000×4000 | Full-frame & APS-C DSLR/mirrorless sensors, 4×6" photo prints |
| 1.91:1 | 1.9048:1 | 1200×630, 2400×1260 | Open Graph (og:image) & Twitter/X summary_large_image cards |
| 21:9 | 2.3333:1 | 2560×1080, 3440×1440, 5120×2160 | Ultrawide desktop monitors and cinematic anamorphic widescreen |
4. Proportional Resizing: Finding Missing Width or Height
When downsizing a high-resolution photo for the web, changing only one dimension without scaling the other causes distortion. Use these two equations—or our Image Dimension Calculator—to compute the exact matching pixel value:
- New Height = Math.round(Target Width × (Ratio Height ÷ Ratio Width))
- New Width = Math.round(Target Height × (Ratio Width ÷ Ratio Height))
5. Modern CSS aspect-ratio for Zero Layout Shift (CLS)
In modern frontend engineering, reserving an image's aspect ratio in CSS prevents page content from jumping while images download over mobile networks:
/* Reserve exact 16:9 widescreen box before the image loads */
.hero-thumbnail {
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
object-fit: cover;
}
Ready to check or resize your own assets? Open the Image Aspect Ratio Calculator & Ratio Checker, inspect display panels with the Screen Aspect Ratio Calculator, check raw file headers in the Image Dimensions Checker, or calculate print density in our 300 DPI to Pixels & PPI Calculator.
Frequently Asked Questions
How do you calculate the aspect ratio of an image from pixels?
To calculate the aspect ratio of an image, find the Greatest Common Divisor (GCD) of the pixel width and height, then divide both numbers by that GCD. For example, an image measuring 1920 × 1080 pixels has a GCD of 120. Dividing 1920 ÷ 120 = 16 and 1080 ÷ 120 = 9, giving an exact 16:9 aspect ratio.
How do I check the aspect ratio of an image file?
Open our interactive Image Aspect Ratio Calculator (/tools/image-aspect-ratio-calculator) and select the "Upload Image Ratio Checker" tab, or use the Image Dimensions Checker (/tools/image-dimensions-checker). Drop any JPG, PNG, WebP, SVG, or AVIF file to read its intrinsic pixel width, height, simplified GCD ratio, nearest standard ratio, and megapixels locally in your browser.
How do I calculate missing width or height while keeping the same image ratio?
To calculate a new height from a target width: New Height = Target Width × (Original Height ÷ Original Width). To calculate a new width from a target height: New Width = Target Height × (Original Width ÷ Original Height). For example, scaling a 16:9 image to a target width of 1280 px gives 1280 × (9 ÷ 16) = 720 px height.
What are the most common image and video aspect ratios?
The most widely used aspect ratios are 16:9 (widescreen HD/4K video, YouTube thumbnails, hero banners), 9:16 (vertical TikTok, Reels, YouTube Shorts), 4:5 (Instagram portrait feed posts at 1080×1350 px), 1:1 (square product photos and avatars), 3:2 (full-frame 35mm DSLR photography and 4×6 prints), and 4:3 (smartphone camera sensors and iPad displays).
How do I lock image aspect ratio in CSS to prevent Cumulative Layout Shift (CLS)?
Always include explicit width and height HTML attributes on <img> elements and apply the modern CSS property aspect-ratio: 16 / 9; (with width: 100%; height: auto; object-fit: cover;). This allows the browser layout engine to reserve the exact bounding box before the image downloads.