MathsGeometry

Aspect Ratio
calculator.

Get any width and height as a simple aspect ratio, or resize a picture without stretching.

How it's worked out

An aspect ratio is the width compared with the height. To put a size in lowest terms, divide both sides by their greatest common divisor, the largest whole number that goes into both. For 1920 by 1080 that number is 120, which leaves 16:9. A 3840 by 2160 picture reduces to the same 16:9, since the shape, not the pixel count, sets the ratio.

g\displaystyle g=gcd⁡(W,H)\displaystyle {}= \gcd(W, H)
ratio\displaystyle \text{ratio}=Wg:Hg\displaystyle {}= \frac{W}{g} : \frac{H}{g}

When a side has decimals, the tool first multiplies both sides by a power of ten, so the divisor is found on whole numbers. So 2.35 by 1 becomes 235 by 100, and that reduces to 47:20. Up to six decimal places count, which means 1.333 stays 1333:1000 and never turns into 4:3.

Resizing holds the shape by scaling both sides with one factor. Two equal ratios make a proportion, so the new height is the new width times the old height over the old width.

Hnew\displaystyle H_{\text{new}}=Wnew×HW\displaystyle {}= W_{\text{new}} \times \frac{H}{W}

Fitting on a screen has two choices. Scale by the smaller of the two side ratios, and the whole picture shows, with bars filling the gap. Scale by the larger one, and the picture covers the screen, with its edges cut. A wider picture than the screen gives a letterbox, with bars above and below. A narrower one gives a pillarbox, with bars at the sides.

Worked examples

Priya exports a camera file for her website

Her camera gives 6000 by 4000 pixels, which is 3:2. The site needs images 1200 pixels wide, so she needs the height that keeps the shape.

Hnew\displaystyle H_{\text{new}}=1200×40006000\displaystyle {}= 1200 \times \frac{4000}{6000}=800\displaystyle {}= 800

The file becomes 1,200 by 800, a scale of 0.2 on each side. Pixel count follows the square of that scale, so she keeps 0.96 of the original 24 megapixels, 96% fewer. That is why a small resize can cut a file so much.

Open this example in the tool

Marco plays a wide film on a Full HD television

His film is 2048 by 858, which is within 0.5% of the 2.39:1 scope ratio. His screen is 1920 by 1080, a narrower shape, so the film touches the sides first.

Fitted, it is 1,920 by 804.4, leaving a 137.8 pixel bar above and below. It uses 74.5% of the screen and shows the whole frame.

A zoom to fill the screen removes the bars, and it costs 25.5% of the picture: about 329 pixels off each side at that scale. Marco keeps the bars, because a film framed for this shape often has something important at the edges.

Open this example in the tool

Jo builds a set of image widths for a page

Jo starts from 1920 by 1080 and wants four smaller widths. The heights come out as 900, 720, 540, 360, all whole, because 1920 and 1080 share so many factors.

A fifth width of 854 does not work as neatly. Its exact height is 480.375, so the rounded size 854 by 480 sits less than a pixel off the ratio. Jo can accept that for an image, and a viewer will not see it.

Open this example in the tool

Reading your result

A marketing name is not an exact ratio. Many screens are sold under a rounded figure. A 2560 by 1080 panel is exactly 64:27, or 2.37, and 3440 by 1440 is 43:18, or 2.389. Both are sold as 21:9, which is 2.333.

The 0.5% rule tells rounding from a new shape. The tool names a standard ratio when a size is within 0.5% of it. So 1366 by 768 counts as 16:9 even though it reduces to 683:384, since it is only 0.05% wider. That rule belongs to this tool, not to any standard. ITU-R BT.709 and BT.2020 are what set 16:9 for 1920 by 1080 and 3840 by 2160.

Halving a side quarters the pixels. Going from 1920 wide to 960 wide gives 960 by 540, a change of −75%. Scaling up cannot add detail the original never had, so a large export from a small file only looks softer.

Common mistakes

  • Typing a rounded decimal. Enter pixel counts when you have them. A value such as 1.78 reduces to 89:50, not 16:9, since the tool treats it as exact.
  • Forcing both sides. Setting a new width and a new height on their own stretches the picture unless the two ratios match. A 4:3 image forced to 1920 by 1080 looks wide and flat.
  • Forgetting odd sizes in video. With 4:2:0 color, the color samples are subsampled by a factor of two each way, so odd sizes cause trouble in many encoders. The even-number size in resize mode keeps you clear of it.
  • Assuming square pixels. Both broadcast standards named here use square pixels, and this tool does too. Some older formats do not, so their stored size and their shape on screen differ.

Questions people ask

Yes, exactly. Both sides divide by 120 to give 16 and 9. ITU-R BT.709 lists that size with a 16:9 picture and square pixels.

Sources