Tested tool guide
Tested browser tools
Checked August 15, 2026
What CSS Aspect Ratio Calculator does, with a checked example
Enter a pixel width and height, or pick a preset like 16:9, 4:3, 1:1, or 21:9, and the tool reduces the pair to its lowest integer ratio using the greatest common divisor, then writes the resulting aspect-ratio: w / h; declaration. A live preview box demonstrates how that ratio holds as its container width changes. The thing people most often get wrong: aspect-ratio is a sizing hint, not a hard constraint. It only takes effect when at least one used dimension is auto; an element with both width and height explicitly set has no auto dimension left for the ratio to fill, and layout contexts that resolve both dimensions through other means, such as stretch alignment in a flex or grid parent, can similarly leave no room for the ratio to apply.
Worked example
A concrete input and expected output from the current implementation.
->
Expected output
aspect-ratio: 16 / 9;
1920 and 1080 share a greatest common divisor of 120; dividing both by 120 reduces the pair to the lowest-terms ratio 16:9, which becomes the CSS value.