Image Aspect Ratios and Cropping on Websites
An aspect ratio is the relationship between an image's width and height, such as 16:9 for wide images or 1:1 for squares. When images with different ratios sit side by side, layouts look uneven. Planning ratios keeps your pages tidy and helps them load without jumping around.
Common aspect ratios
- 1:1: square, used for avatars, product tiles, and social feeds
- 4:3 and 3:2: classic photo shapes
- 16:9: widescreen, common for video and hero images
- 4:5 and 2:3: tall, suitable for portraits and product photos on some stores
- 21:9: very wide banner shapes
Choose a few and stick to them
Decide which ratios your site uses and for what. For example, product thumbnails at 1:1, blog headers at 16:9, and team portraits at 4:5. Add these to your design system. Consistency makes grids look professional.
Reserve space to avoid layout shift
Set width and height attributes on images, or use the CSS aspect-ratio property, so the browser knows how much room to leave before the file arrives. Otherwise the page jumps as images load, which harms cumulative layout shift.
Crop in the browser with care
CSS object-fit: cover fills a frame by cropping the image, while object-fit: contain shows the entire image with space around it. Use cover for photos in cards and contain for logos and products where cropping would cut off important parts.
You can control which part stays visible with object-position. For portraits, keep the focus near the top so heads are not cut off.
Plan for different screens
A wide hero image that looks great on a desktop may crop awkwardly on a phone. Options:
- Choose images with a clear subject near the center
- Use the
pictureelement to serve a different crop on small screens - Leave space around key subjects when taking photos
See responsive images for the technical side.
Photograph with the layout in mind
Take photos a little wider than you need so there is room to crop. Keep faces and key products away from the edges.
Never stretch or squash
Distorted images look amateur. Always keep proportions and crop instead.
Keep important text out of images
Text baked into pictures cannot scale, cannot be read by screen readers, and gets cropped. Use real text over or beside the image. See alt text best practices.
Quick checklist
- Do all images in a row share a ratio?
- Are width and height set?
- Is the key subject safe in each crop?
For general guidance on pictures, see how to use images on your website. When you are ready to start from a ready-made look, read how to choose a website template.