Built-in toolFree · No signup
CSS Aspect Ratio Helper
Generate CSS for maintaining fixed aspect ratios responsively. Get the modern aspect-ratio property (97%+ browser support) and the classic padding-bottom percentage hack for legacy targets. Includes 8 common ratio presets and a custom ratio input.
Share:
Custom ratio
:= 16:9 simplified · padding-bottom: 56.2500%
400px → height 225px
Preview — 16:9
16:9 — 400 × 225px
Was this tool helpful?
How to use
01
Pick a ratio
Choose from common ratios like 16:9 (video), 4:3 (classic TV), 1:1 (square), or enter a custom width:height.
02
Resize preview
Drag the width slider to see how the element maintains its ratio at different container sizes.
03
Choose approach
Modern aspect-ratio is clean and simple. Use the padding-bottom hack only if you need IE11 or very old browser support.
04
Copy CSS
Copy the complete CSS including both the modern and legacy approaches for maximum compatibility.