arrow_back All utils
aspect_ratio

Aspect ratio

Compute a dimension at a fixed ratio

Ratio

Find the missing dimension of an image or a video at a constant ratio. You know one width and an aspect ratio, the tool gives the matching height, and the other way round.

How it works

An aspect ratio is simply width divided by height. Keeping that ratio while changing one dimension means multiplying or dividing the other by the same factor, which is what stops images from being stretched.

height = width × h ÷ w
width  = height × w ÷ h
(for a w:h ratio)

Frequently asked questions

Which ratios are most common?

16:9 for video and most displays, 4:3 for older formats and many projectors, 1:1 for square posts, 9:16 for vertical formats like stories, 21:9 for cinemascope.

How do I keep a ratio in CSS?

The aspect-ratio property does it natively: aspect-ratio: 16 / 9 on a container is enough, with no padding hack to calculate. Every current browser supports it.