Digital Hub Lab
Aspect-Ratio Calculator
Simplify an aspect ratio, calculate matching dimensions and generate a CSS aspect-ratio declaration.
Convert dimensions into a simplified ratio and calculate a matching width or height without stretching the original proportions.
Preparing the interactive tool…
This interactive tool requires JavaScript. Enable JavaScript and reload the page to use it.
How to use this tool
- Enter the original width and height.
- Review the simplified and decimal ratios.
- Enter a new width or height.
- Copy the CSS ratio or use the calculated matching dimensions.
Understanding the result
Aspect ratio describes proportional shape, not resolution or visual quality. Two images can share a ratio while having very different pixel dimensions.
Practical guidance
Use the correct ratio to prevent layout shifts and unwanted cropping. Still provide enough source pixels for the image’s intended display size.
