About this tool
Enter a width and height ratio to generate a responsive aspect-ratio box, with both the modern aspect-ratio CSS and a padding-top percentage fallback, all in your browser.
Decimals are allowed (a comma also works). Up to six decimal places are scaled to whole numbers before reducing, so 2.35 by 1 gives 47 / 20. The fallback sets padding-top to height over width as a percentage rounded to three decimals (56.25% for 16 by 9) and stretches any direct child with position: absolute and inset: 0. Zero, negative or non-numeric entries show an invalid message.