Aspect ratio calculator
Get the ratio and the CSS aspect-ratio value from a width and a height, and resize while keeping it.
Runs in your browser. Nothing you enter is uploaded.
- Ratio
- Width / Height
Resize
About this tool
This calculator reduces a width and height to their simplest ratio, gives the decimal value and the matching CSS aspect-ratio declaration. Decimal sizes work too, so 1.5 by 1 becomes 3:2. Enter a new width or height to get the other side at the same ratio.
- How is the ratio simplified?
- Both sides are divided by their greatest common divisor, so 1920 by 1080 becomes 16:9. Values are rounded to three decimal places first.
- Can I use the output directly in CSS?
- Yes. It is written as aspect-ratio: 16 / 9; and the preview box uses the same value.