CSS & Layout

Aspect Ratio Calculator

Turn any width and height into a simplified ratio, or use a ratio to find the missing dimension. The live preview and copied CSS update as you type. Everything runs in your browser — your input never leaves the page.

Runs in your browser v1.0.0

Your numbers

live
What do you already know?

Units are optional — an aspect ratio only depends on the relationship between the numbers.

Result

live


                    

Live preview

Landscape

Common ratios

tap to apply

Each shape is drawn to scale, so you can compare proportions at a glance. Select one to load it into the calculator.

How it works

An aspect ratio compares width to height. This tool divides both numbers by their greatest common divisor, so 1920×1080 becomes 16:9, and it can also work backwards: give it a ratio and one dimension to get the other. The CSS output uses the modern aspect-ratio property, which keeps an element proportional at any size. Every calculation happens in your browser and is never sent anywhere.