How to use the aspect ratio calculator
- Enter a width and height, or pick a common ratio from the list.
- See the simplified ratio in the preview box, which takes that shape.
- Choose the known side (width or height) and type the size you need.
- Read the other side in the preview and the checks.
- Export CSS, Tailwind or an image tag with width and height attributes.
Common ratios
- 16:9: HD and 4K video, YouTube, most screens.
- 9:16: vertical video for Stories, Reels and Shorts.
- 4:3: classic photos and older displays; many phone camera photos.
- 3:2: DSLR and mirrorless camera photos.
- 1:1: square social posts and avatars.
- 4:5: portrait social posts.
- 1.91:1: link preview (Open Graph) images, 1200 × 630.
- √2 (1:1.414): A-series paper such as A4.
How it works
An aspect ratio is width divided by height, written in its simplest whole-number form. The calculator divides both sides by their greatest common divisor, so 1920 × 1080 becomes 16:9. To find a missing side it uses the same proportion: height = width × (ratio height ÷ ratio width). The CSS output uses the aspect-ratio property, which reserves the right amount of space before an image or video loads, so the layout doesn’t jump.
Worked examples
Example 1: a responsive video embed
Load HD video. Apply aspect-ratio: 16 / 9; width: 100% to the iframe. It scales with its container and never letterboxes or jumps.
Example 2: an Open Graph image
Load Open Graph image (1200 × 630, 40:21). Use it to size social share images so they aren’t cropped in link previews.
Example 3: a product grid
Set the ratio to 4:5 and apply it to every product image with object-fit: cover. Photos of different shapes are cropped consistently, and the grid lines up.
Common mistakes
- Fixing both width and height in CSS. Images stretch; set one and let aspect-ratio or height: auto do the rest.
- Forgetting object-fit. Without
object-fit: cover, images squash to fit the box. - Rounding to odd pixels for video. Many encoders need even dimensions.
Accessibility and performance notes
Reserving space is one of the simplest ways to improve Core Web Vitals. When every image, video and embed has a known shape before it loads, nothing below it moves, so readers don’t lose their place and don’t tap the wrong link by accident. That matters most on slow mobile connections, where images can arrive seconds after the text.
Remember that a fixed ratio can crop important content. If a photo has text or faces near its edges, check it at the chosen ratio or use object-position to keep the subject in view. For charts and diagrams, prefer the image’s natural ratio so nothing is cut off, and always give meaningful images an alt description.