Skip to main content

CSS Aspect Ratio Generator

Create responsive aspect ratios for images, videos, and containers.
Use presets or define your own custom ratio.

16:9
HD Video
Preview size: 300px x 169px
16
9
300px
aspect-ratio: 16 / 9;

About the CSS aspect-ratio Property

The aspect-ratio CSS property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and some other layout functions.

Responsive Images

Prevent layout shift by reserving space for images before they load. Perfect for lazy loading.

Video Embeds

Maintain proper 16:9 or 4:3 ratios for embedded videos without using the old padding-top hack.

Card Layouts

Create uniform grid layouts where cards maintain consistent proportions regardless of content.

Browser Support

The aspect-ratio property is supported in all modern browsers including Chrome 88+, Firefox 89+, Safari 15+, and Edge 88+. For older browsers, consider using the padding-top percentage technique as a fallback.

Example Usage

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.square-avatar {
  width: 80px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
}