Aspect Ratio Calculator

Simplify any width × height into its aspect ratio, or find the missing dimension — in your browser.

How to use

  1. Type a width and a height in pixels — or click a preset such as Full HD, 4K, Story 9:16 or the YouTube thumbnail size.
  2. Read the simplified ratio, its common name, the decimal value and the ready-to-paste CSS aspect-ratio declaration.
  3. Switch to the second mode to go the other way: enter a ratio like 16:9 plus one dimension and the missing one is filled in for you.

About this tool

An aspect ratio is nothing more than the width of an image divided by its height, expressed in the smallest whole numbers possible. This calculator finds those numbers by dividing both sides by their greatest common divisor, computed with the Euclidean algorithm: 1920 and 1080 share a divisor of 120, so 1920×1080 collapses to 16:9. Working the other way is just as useful — give it a ratio and one dimension and it returns the other, which is the calculation behind every "resize without distorting" task.

The tool also names the result, and it is honest about the gap between marketing names and the actual math. Some ratios are exact: 1920×1080, 2560×1440 and 3840×2160 are all genuinely 16:9. Others are not. The popular "21:9" ultrawide is a marketing label — a 2560×1080 monitor is really 64:27 and a 3440×1440 one is 43:18, both about 2% away from a true 21:9. When the simplified ratio does not match a standard one exactly, the result shows the real numbers first and then points to the closest common name with the size of the difference, plus the film equivalent when it lands on 1.85:1 or the 2.39:1 anamorphic scope.

In practice this matters in three places. In video, delivery specs are written as ratios rather than resolutions, and encoders generally want even pixel dimensions, so the tool flags an odd result. On social platforms, each surface expects its own frame: 1:1 and 4:5 for feed posts, 9:16 for Stories, Reels and Shorts, 16:9 for YouTube and its 1280×720 thumbnail. In CSS, the modern aspect-ratio property lets a container hold its shape at any width — the calculator prints the declaration for you, ready to paste. All the arithmetic runs 100% in your browser; nothing you type is sent anywhere.

The formula

Simplified ratio = width ÷ GCD : height ÷ GCD, where GCD is the greatest common divisor of the two numbers (Euclidean algorithm). Missing dimension: height = width × ratio height ÷ ratio width, and width = height × ratio width ÷ ratio height. Example: GCD(1920, 1080) = 120 → 16:9; at 16:9, a width of 1280 gives a height of 1280 × 9 ÷ 16 = 720.

Frequently asked questions

How is an aspect ratio calculated?

Divide the width and the height by their greatest common divisor. For 1920×1080 the GCD is 120, which gives 16:9 — the same ratio as 1280×720 and 3840×2160, since they are all multiples of the same shape.

Why does 2560×1080 show 64:27 instead of 21:9?

Because 64:27 is the exact math and "21:9" is a rounded marketing name for ultrawide displays. The two are about 1.6% apart, which is why the tool shows the true ratio first and the common name next to it.

Which ratio should I use for social media?

Use 9:16 for Stories, Reels, Shorts and TikTok, 1:1 or 4:5 for Instagram feed posts, and 16:9 for YouTube videos and their 1280×720 thumbnails. Presets for each of these are one click away.

How do I use this in CSS?

Apply the aspect-ratio property to the container — the calculator prints the exact declaration, for example aspect-ratio: 16 / 9. The element then keeps its shape at any width, which removes the old padding-top percentage hack.

Why does my result need to be an even number?

Most video codecs subsample chroma in 2×2 blocks, so encoders such as H.264 require even width and height and will refuse or silently pad odd dimensions. The tool warns you when a computed dimension comes out odd.

Do the dimensions I type leave my browser?

No. The whole calculation is plain JavaScript running on your device — the numbers are never uploaded, logged or stored anywhere.

Related tools

Long links? Shorten them for free

Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.

Vai.la is not responsible for how the tools are used or for decisions made based on their results.