web · 6 min read

Aspect ratios — the numbers, and how to keep them

A ratio is a shape, not a size. Everything awkward about them comes from treating the two as the same thing.

Aspect ratio is width divided by height, and that single number is the whole of the arithmetic. 16:9 is 1.777…; multiply or divide by it to get from one dimension to the other.

Written as a:b it is the same fraction reduced — 1920:1080 divided by their greatest common divisor of 120 gives 16:9. Which is why 1920 × 1080 and 640 × 360 are the same ratio at very different sizes.

The ones worth knowing

16:9 — video, screens, YouTube, presentations. The default for everything moving.

9:16 — vertical video. Reels, Shorts, TikTok, stories.

4:5 — the tallest a feed post is allowed on Instagram, and therefore the one that occupies the most screen.

1:1 — square. Avatars, and feed posts where the crop must be predictable.

1.91:1 — the link preview shape, which is what an Open Graph card is cropped to. 1200 × 630 is the usual size.

3:2 — most cameras, and 6 × 4 prints. 4:3 — older screens, iPads, and a good deal of stock photography.

√2:1 — A-series paper, which is the ratio that survives being folded in half. A4 folded gives A5 at the same shape, and no other ratio does that.

Cropping, and what it costs

Changing a ratio means removing pixels or adding empty space. There is no third option.

Cover fills the box and crops the overflow. Right for backgrounds and thumbnails, and it will cut a head off a portrait when the box is wide.

Contain fits the whole image and leaves gaps. Right for logos and diagrams, where losing an edge loses meaning.

The one to avoid is stretching to fit, which distorts everything and is instantly visible on any face. If a ratio has to change, crop deliberately so you choose what goes rather than letting a container decide.

Where the same image is shown at several ratios — a card, a banner, a thumbnail — the subject has to survive the tightest crop. Composing with the important part near the centre is the only reliable answer.

The layout shift problem

An image with no stated dimensions occupies no space until it loads, so the page renders, the image arrives, and everything below it jumps down. It is one of the most common causes of a poor layout-shift score and one of the easiest to fix.

Set width and height attributes on the image. Browsers use them only to compute the ratio and reserve the space — the CSS still controls the rendered size, so this does not fight your stylesheet.

For containers, embeds and video, the CSS aspect-ratio property does the same job, and it replaced the padding-top percentage trick that this used to require.

Resolution is not ratio

"1080p" is a height. "4K" is roughly a width. Neither states a shape, which is why cinema 4K and consumer 4K are different ratios at nearly the same pixel count.

When somebody asks for 16:9 they mean the shape; when they ask for 1080p they mean the size. Supplying one for the other is where most of the confusion in a handoff comes from — and pixel counts have their own confusion.

Working it out

A calculator answers the two questions that come up: what height matches this width at this ratio, and what ratio is this pair of numbers. The second is the one worth doing before assuming — a set of assets that look consistent are frequently three slightly different ratios.

The short version

Width over height, one number, and every ratio question is that arithmetic. 16:9 for video, 9:16 vertical, 4:5 for feeds, 1.91:1 for link previews. Always give an image its dimensions so the page does not jump. And crop on purpose rather than letting a container choose.

Questions

How do I calculate an aspect ratio?

Divide the width by the height for the ratio, then keep it by multiplying: a new height is the new width divided by that figure. 1280 ÷ 720 is 1.777…, so any width divided by 1.777 gives the matching 16:9 height. To express it as a:b instead, divide both sides by their greatest common divisor.

What is 16:9 in pixels?

Any pair whose width divided by height is 1.777… — 1920 × 1080, 1280 × 720, 3840 × 2160 and 640 × 360 are all 16:9. The ratio is a shape, not a size, which is why a resolution and a ratio are different things.

What aspect ratio is an Instagram post?

1:1 square and 4:5 portrait for feed posts, and 9:16 for reels and stories. 4:5 occupies the most vertical space a feed post is allowed, which is why it is the one most accounts use.

How do I stop images jumping around while a page loads?

Give the browser the shape before the image arrives. Setting the width and height attributes on the img element is enough — modern browsers compute the ratio from them and reserve the space. The CSS aspect-ratio property does the same for containers.

What is the difference between cover and contain?

Cover fills the box and crops whatever does not fit. Contain fits the whole image inside and leaves empty space. Cover is right for backgrounds and thumbnails; contain is right when the image is a logo or a diagram where cropping loses meaning.

Tools from this guide