Aspect Ratio Calculator - Image & Video Size Calculator Online
Calculate aspect ratios for images and videos. Resize while maintaining proportions with common presets (16:9, 4:3, 1:1) and responsive dimensions.
Frequently Asked Questions
What is an aspect ratio?
An aspect ratio is the proportional relationship between the width and height of an image, video, or screen. It is expressed as two numbers separated by a colon (e.g., 16:9), where the first number represents the width and the second represents the height. Common aspect ratios include 16:9 (widescreen HD), 4:3 (traditional TV), and 1:1 (square). Understanding aspect ratios is crucial for resizing images without distortion and ensuring content displays correctly across different screens and platforms.
How do I use this aspect ratio calculator?
Enter the width and height of your image or video in the input fields. The tool instantly calculates and displays the simplified aspect ratio (e.g., 16:9), decimal ratio, and orientation. To quickly set dimensions, click a ratio preset button (16:9, 4:3, 1:1, etc.) or use the platform presets for YouTube, Instagram, TikTok, and more. Switch to the Resize tab to proportionally scale existing dimensions to a target size.
Is my data safe? Does anything get sent to a server?
All calculations are performed 100% client-side in your browser using JavaScript. No dimension data, images, or any other information is transmitted to any server. This tool works entirely offline once loaded, making it safe for use with confidential project specifications and proprietary media dimensions.
What is the difference between 16:9 and 1.78:1?
They represent the same aspect ratio in different formats. "16:9" is the simplified integer ratio, while "1.78:1" (more precisely 1.7778:1) is the decimal representation obtained by dividing 16 by 9. The integer format (16:9) is commonly used in consumer media and display specifications, while the decimal format is used more in cinema and professional video production (e.g., 2.35:1 for anamorphic widescreen).
How do I calculate the height if I know the width and aspect ratio?
Use the formula: height = width × (ratio height / ratio width). For example, for a 16:9 ratio with a width of 1920: height = 1920 × (9/16) = 1080. This calculator automates this process — simply enter 1920 as the width after selecting the 16:9 preset, and the height of 1080 is calculated automatically.
What aspect ratio should I use for YouTube videos?
YouTube recommends 16:9 (widescreen) for standard videos, with common resolutions being 1920×1080 (1080p), 2560×1440 (1440p), and 3840×2160 (4K). YouTube Shorts use 9:16 (vertical) at 1080×1920. The platform automatically adds letterboxing if your video does not match 16:9, so using the correct ratio avoids black bars.
How does the GCD (Greatest Common Divisor) simplification work?
The tool simplifies ratios by finding the Greatest Common Divisor of the width and height, then dividing both by it. For example, 1920×1080: GCD(1920, 1080) = 120, so 1920/120 = 16 and 1080/120 = 9, giving a ratio of 16:9. Some dimensions may produce unusual simplified ratios (e.g., 1366×768 simplifies to 683:384) — in these cases, the tool also shows the nearest standard ratio.
Code Examples
// Aspect Ratio Calculator in JavaScript
// Calculate GCD using Euclidean algorithm
function gcd(a, b) {
a = Math.abs(Math.round(a));
b = Math.abs(Math.round(b));
while (b) {
[a, b] = [b, a % b];
}
return a;
}
// Calculate aspect ratio from width and height
function calculateAspectRatio(width, height) {
if (width <= 0 || height <= 0) {
throw new Error('Width and height must be positive numbers');
}
const divisor = gcd(width, height);
return {
ratioWidth: width / divisor,
ratioHeight: height / divisor,
decimal: +(width / height).toFixed(4),
label: `${width / divisor}:${height / divisor}`,
};
}
// Calculate missing dimension
function calculateMissingDimension(ratioW, ratioH, knownDimension, type) {
if (type === 'width') {
return Math.round((knownDimension * ratioW) / ratioH);
} else {
return Math.round((knownDimension * ratioH) / ratioW);
}
}
// Scale dimensions proportionally
function scaleDimensions(originalW, originalH, targetW, targetH) {
if (targetW) {
const factor = targetW / originalW;
return { width: targetW, height: Math.round(originalH * factor), factor };
}
if (targetH) {
const factor = targetH / originalH;
return { width: Math.round(originalW * factor), height: targetH, factor };
}
}
// Example usage
const ratio = calculateAspectRatio(1920, 1080);
console.log(ratio);
// { ratioWidth: 16, ratioHeight: 9, decimal: 1.7778, label: "16:9" }
const height = calculateMissingDimension(16, 9, 2560, 'height');
console.log(`2560 x ${height}`);
// "2560 x 1440"
const scaled = scaleDimensions(1920, 1080, 1280, null);
console.log(`${scaled.width} x ${scaled.height} (${(scaled.factor * 100).toFixed(1)}%)`);
// "1280 x 720 (66.7%)"