Aspect Ratio Calculator
Calculate simplified aspect ratios via GCD, scale pixel dimensions proportionally, and copy CSS aspect-ratio rules in your browser.
About this tool
An aspect ratio calculator simplifies image or video dimensions into their lowest integer ratio using the Greatest Common Divisor (GCD) and computes matching scaled dimensions without stretching or cropping. Euclidean GCD divides both integer dimensions to yield the simplest ratio (e.g., 1920 / 120 = 16 and 1080 / 120 = 9). Target dimensions scale by H2 = Math.round(W2 × (H1 / W1)).
How to use the aspect ratio calculator
- Enter the width and height of your source image in W1 and H1.
- Enter a new width or height in W2 and H2, leaving the other box empty so the tool can work it out.
- Or press a preset such as 16:9 or 1:1 to fill the target size.
- Read the new size and copy the CSS aspect-ratio rule if you are laying out a web page.
What an aspect ratio is
An aspect ratio is the proportion between width and height, written as two numbers such as 16:9. A 1920 by 1080 image has the ratio 16:9, and any size with the same proportion, such as 1280 by 720 or 640 by 360, looks the same, only smaller. Keeping the ratio stops an image from looking stretched or squashed when you resize it.
Common ratios are 16:9 for video and widescreen screens, 4:3 for classic displays, 1:1 for square social posts, 9:16 for phone stories, and 21:9 for ultrawide monitors.
A worked example
A photo of 4000 by 3000 pixels has a 4:3 ratio. Setting the target width to 1200 gives a height of 900, because 1200 divided by 4 and multiplied by 3 is 900. Setting the target height to 1080 for a 16:9 frame gives a width of 1920 only if the source ratio is also 16:9, so the tool shows the crop or fit you would need instead.
- Work out the height of a 1200 pixel wide banner in a 3:1 ratio, which is 400 pixels.
- Find the right size for a 1:1 profile image from a 1600 by 900 photo, which is 900 by 900 after cropping.
Who uses an aspect ratio calculator
- Web designers sizing hero images and cards.
- Video editors and social media managers preparing frames for each platform.
- Photographers preparing prints in standard frame sizes.
- Developers setting the CSS aspect-ratio property for responsive images.
- Students learning proportions and scaling.
Tips and common mistakes
- Resizing without keeping the ratio stretches the image. Lock the ratio in the image resizer to avoid this.
- Round the other dimension to a whole number of pixels, because a fraction of a pixel cannot be saved.
- Responsive images still need a fallback size for older browsers.
- The calculation is exact for the numbers you enter. Check the final export before you publish it.
- All calculations run in your browser, and nothing is uploaded.
Frequently asked questions
Related browser tools
Box Shadow Generator
Design soft CSS box shadows visually with X/Y offset, blur, spread, opacity, and inset controls locally in your browser.
Color Converter
Convert colors between HEX, RGB, HSL, and CSS OKLCH with a live swatch preview and RGB sliders locally in your browser.
WCAG Contrast Checker
Check WCAG 2.1 AA and AAA color contrast ratios between foreground and background colors with live preview cards locally in your browser.