CSS Aspect Ratio Generator

Generate CSS aspect-ratio property with common presets (16:9, 4:3, 1:1, 21:9). Includes padding-bottom fallback for older browsers and live preview.

How to Use CSS Aspect Ratio Generator

The CSS Aspect Ratio Generator creates CSS code for maintaining aspect ratios on elements. Choose from common presets (16:9 widescreen, 4:3 standard, 1:1 square, 21:9 ultrawide) or enter custom ratios. The tool generates both the modern aspect-ratio property and a padding-bottom fallback for older browsers. A live preview shows exactly how your element will look. Set a custom container width for precise control. Perfect for responsive video containers, image placeholders, and card layouts.

Step-by-Step Instructions

  1. Select a preset ratio or enter custom width and height values
  2. Optionally set a container width
  3. View the live preview of your aspect ratio
  4. Copy the generated CSS including the fallback code

Related Tools

More Free Tools