Try the inputs from this article

Run the example or change the input to compare results. Tool functions and standard browser APIs calculate the results in your browser.

Run example

Changing the input clears the previous result.

Example input file

These are illustrative inputs. Result field names are code identifiers; see the article for units and conditions.

16:9 and 4:3 ratios: quick pixel examples

Aspect ratio = (width ÷ greatest common divisor) : (height ÷ greatest common divisor). All dimensions below are width × height; these are examples, not upload requirements for any service.

Aspect RatioPixel examples (width × height)
16:91920 × 1080, 1280 × 720
4:31200 × 900, 800 × 600
1:11080 × 1080
9:161080 × 1920, 720 × 1280

Open the aspect ratio calculator

How do I calculate the aspect ratio?

If you divide the width and height by the same number, the proportions are maintained. The greatest common divisor of 1920 and 1080 is 120, so dividing them by 120 is 16:9. 1200×900 is 4:3, 1080×1080 is 1:1. A vertical image 1080×1920 is 9:16, and if you change the order of width and height, the ratio will also be reversed.

File size and aspect ratio are different pieces of information. Even with the same 16:9 ratio, storage capacity varies depending on resolution, file format, compression settings, and picture complexity. You can't estimate how many kilobytes it will be just by calculating the ratio.

Calculate dimensions from a new width or height

  1. Check the original width and height from the file information and enter them into the calculator.
  2. Select By width or By height.
  3. Enter the target size for the selected side. The output size and calculation formula are updated immediately.
  4. Apply results rounded to integer pixels in editing tools.
newHeight = newWidth × originalHeight / originalWidth
1280 × 1080 / 1920 = 720
1000 × 1080 / 1920 = 562.5
newWidth = newHeight × originalWidth / originalHeight
900 × 1920 / 1080 = 1600

At a target width of 1000, the exact height is 562.5; rounding gives 563. For an exact 16:9 ratio with integer pixels, choose a width divisible by 16. For example, 992×558 is exactly 16:9. Rounding can introduce a small aspect-ratio error.

The original width, original height and target side must each be integers from 1 to 1,000,000. This input limit does not cap the calculated other side at 1,000,000. For a hypothetical 1×1,000,000 original and a target width of 2, the result is 2×2,000,000. That is a calculation, not a size the image editor necessarily supports.

Difference between maintaining ratio, cropping, and adding margin

Scaling both sides by the same factor preserves the full scene and aspect ratio. To fill a square with a 16:9 image, crop part of the scene or stretch the sides by different factors. Stretching distorts shapes; padding preserves the full scene with extra space. This calculator only finds dimensions and does not crop, stretch or add padding.

If the calculated side rounds to 0 pixels, increase the target size of the selected reference side. For a hypothetical 1×1,000,000 original, setting the target height to 1 gives a width of 0; increase the target height in this case. The image resizer calculates height from width and requires each output side to be 1–8,192px, with at most 25 million pixels total. A valid calculator input can still exceed those image-output limits.

The ratio and pixel examples in this article are verified with actual function results from a calculator. Upload specifications for specific platforms may change, so please check separately the current specifications for the service you wish to post to.

W3C CSS Box Sizing: aspect-ratio · ECMAScript Math.round

Frequently Asked Questions

Do I need to upload an image?

No. Just enter the numbers for Original Width, Original Height, and Target Size. This tool does not read image content or save files.

Is it possible to calculate the width based on the new height?

Select By height and enter the target height. The calculator finds the new width without swapping the original width and height.