Aspect Ratio Explained: How to Resize Images Without Stretching Them

Understand image aspect ratio, common ratios, proportional resizing, cover vs contain and how to calculate dimensions without stretching images.

On this page15 sections
  1. How aspect ratio is written
  2. How to calculate a missing dimension
  3. Why images stretch
  4. Intrinsic ratio vs layout ratio
  5. Cover, contain and fill
  6. Aspect ratio and permanent cropping
  7. Common ratios and where they tend to work
  8. Aspect ratio on mobile vs desktop
  9. Aspect ratio and responsive image source selection
  10. Aspect ratio also helps prevent layout shift
  11. Worked example: one photo, three ratios
  12. Aspect-ratio checklist
  13. Use the ratio while resizing
  14. Frequently asked questions
  15. Sources and further reading

Aspect ratio is the relationship between an image’s width and height. It describes shape, not absolute size. A 1600×900 image and a 320×180 image are both 16:9. A 1200×800 image and a 600×400 image are both 3:2.

This simple relationship controls a surprising amount of web-image behavior: whether an image stretches, how much must be cropped to fit a component, which hero composition works on mobile, and how the browser can reserve the correct amount of space before the file loads.

Short version: preserve the original ratio when you only want to change scale. Change the ratio deliberately when you want a new composition. Never force both dimensions to unrelated values unless distortion is intentional.

How aspect ratio is written

Aspect ratio is normally written as width:height. Examples:

  • 1:1 — square
  • 4:3 — moderately landscape
  • 3:2 — common photographic proportion
  • 16:9 — wide landscape
  • 3:1 — shallow banner

The ratio can also be expressed as a number. For 16:9, 16 ÷ 9 ≈ 1.7778. Any dimensions with the same width/height quotient share the same aspect ratio.

How to calculate a missing dimension

To preserve a ratio, calculate one dimension from the other.

For 16:9 at 1440 pixels wide:

height = 1440 × 9 ÷ 16 = 810

For 3:2 at 1200 pixels wide:

height = 1200 × 2 ÷ 3 = 800

For a 4:3 image at 900 pixels high:

width = 900 × 4 ÷ 3 = 1200

Why images stretch

Stretching happens when the displayed or encoded width/height relationship no longer matches the image’s intended ratio. A 1600×900 image forced into 1000×1000 without cropping becomes distorted because 16:9 has been turned into 1:1.

Faces, circles, type and product shapes make that distortion obvious. The correct alternatives are usually:

  • preserve the ratio and allow the other dimension to follow;
  • crop to the new ratio;
  • fit the whole image inside the box with empty space;
  • fill the box while clipping excess image area.

Intrinsic ratio vs layout ratio

A raster image has an intrinsic ratio derived from its pixel dimensions. A 1200×800 JPEG has a 3:2 intrinsic ratio. A component in the page can have its own preferred ratio, such as a 1:1 card.

Those two ratios do not have to match. The design decision is how the image should behave when they differ.

MDN’s aspect-ratio documentation explains that replaced elements such as images have intrinsic dimensions and ratios, while CSS can define a preferred aspect ratio for the box.

Cover, contain and fill

cover preserves the image ratio and fills the box, clipping excess areas.

contain preserves the ratio and keeps the entire image visible, leaving unused space when the box ratio differs.

fill makes the content fill the box even when that changes the displayed ratio, which can stretch the image.

For photographs and products, cover or contain are usually safer than fill because proportions remain correct.

Aspect ratio and permanent cropping

If a design system requires a 16:9 hero but the source is 3:2, you can create a permanent 16:9 crop. This removes part of the source and gives you a dedicated asset whose intrinsic ratio now matches the component.

That can be useful when the crop is editorially important and should stay consistent. See Crop vs Resize for the difference between permanent crops and layout-time clipping.

Common ratios and where they tend to work

1:1

Useful for compact card grids, avatars, thumbnails and many ecommerce collection layouts. It is predictable in responsive grids but can require substantial cropping from landscape photography.

4:3

A flexible editorial ratio with more vertical room than 3:2 or 16:9. It often works well for product images, editorial features and interface screenshots.

3:2

Common in photography and useful when you want to preserve much of a camera-origin composition without making it extremely wide.

16:9

Common for video-aligned media, wide editorial imagery and some hero sections. It provides a familiar wide frame, but mobile art direction may still be necessary.

Very wide ratios

Ratios such as 3:1 can work for banners but make subject placement critical. A centered person or product may become too small; negative space and focal-point control matter more as the frame gets shallower.

Aspect ratio on mobile vs desktop

A single ratio is not always the best answer across breakpoints. A 16:9 desktop hero can become visually weak on a narrow phone because the subject occupies too little of the available screen.

Two common approaches are:

  1. same image, different box: use cover and reposition the visible crop with object-position;
  2. different crop: use <picture> to art-direct a mobile composition.

The second option is stronger when important content would otherwise be clipped or become too small.

Aspect ratio and responsive image source selection

Responsive image candidates described by width—such as 480w, 960w, and 1920w—should normally represent the same composition and aspect ratio. The browser can then choose among resolutions without changing the visual content.

If the composition changes, treat that as art direction, not simply another resolution candidate. MDN separates these two problems in its responsive-images documentation.

Aspect ratio also helps prevent layout shift

When the browser knows the image’s width and height, it can derive an aspect ratio and reserve space before the image has downloaded. That reduces the chance that later content jumps when the resource appears.

This is why adding intrinsic width and height attributes remains valuable even when CSS makes the image responsive. Read How Image Dimensions Help Prevent CLS for the performance side of that decision.

Worked example: one photo, three ratios

Start with a 3000×2000 (3:2) photograph.

Article image: keep 3:2 and resize to 1200×800.

Square card: crop a 2000×2000 region around the subject, then resize to the card’s source widths.

16:9 hero: crop to 3000×1688 approximately, reposition the subject, then generate responsive candidates. For mobile, consider a separate crop if the desktop composition does not survive the narrow viewport.

The important point is that each ratio is a composition choice. The final pixel dimensions come after that choice.

Aspect-ratio checklist

  1. Identify the source ratio.
  2. Identify the component ratio.
  3. If they match, resize proportionally.
  4. If they do not match, choose crop, cover or contain intentionally.
  5. Never force both dimensions independently unless distortion is desired.
  6. Verify focal points on mobile and desktop.
  7. Keep responsive resolution candidates within the same composition.
  8. Supply intrinsic dimensions so the browser can reserve space.

Use the ratio while resizing

In the browser image tool, use a target width or height based on your layout and keep the corresponding dimension proportional to the source. If the destination needs a different ratio, crop the source deliberately before creating the final delivery size.

Frequently asked questions

What is the best aspect ratio for website images?

There is no single best ratio. The component determines it. Article images, product grids, cards, banners and heroes have different composition needs.

How do I resize a 16:9 image without stretching?

Keep the width and height proportional: 1920×1080, 1600×900, 1280×720, 960×540 and 640×360 are all 16:9.

What happens if the image and container have different ratios?

You must decide whether to show the whole image with unused space, crop/clamp the visible area to fill the box, or create a dedicated crop that matches the component.

Does aspect ratio affect file size?

Indirectly. Ratio alone does not determine bytes, but different dimensions and crops change the number and content of pixels that must be encoded.

Sources and further reading

Continue the series8 parts

Image Resizing & Dimensions

A practical series on choosing, resizing, cropping, and delivering the right image dimensions for the web.

  1. Image Resizing: The Complete Guide to Dimensions, Resolution and Aspect Ratio
  2. How to Resize an Image Without Losing Visible Quality
  3. Crop vs Resize: What’s the Difference?
  4. Aspect Ratio Explained: How to Resize Images Without Stretching Them
  5. Best Image Size for a Website: Hero, Banner, Blog and Content Images
  6. Best Hero Image Size for Desktop and Mobile
  7. Pixels vs Resolution vs File Size: What Actually Matters on the Web?
  8. Does DPI Matter for Web Images? The 72 DPI Myth Explained