Design Tools
Aspect Ratio Calculator
Simplify a width and height to a ratio such as 16:9, scale to a new width or height with optional even rounding, and get CSS aspect-ratio and padding-top code.
How to use Aspect Ratio Calculator
Enter the original width and height, say whether you know the new width or the new height, and type it in. The scaled size, simplest ratio, nearest common ratio and CSS appear instantly; choose a rounding mode for pixel or video sizes.
- Enter the original sizeType the original width and height, for example 1920 and 1080. Decimals are allowed.
- Give the new width or heightChoose which side you know, enter it, and pick two decimals, whole numbers or the nearest even number.
- Use the ratio and CSSCopy the scaled size, the simplest ratio, or the aspect-ratio and padding-top CSS lines.
How the ratio and new size are worked out
The simplest ratio divides both sides by their greatest common divisor: 1920 and 1080 share 120, which gives 16:9. Scaling keeps the same proportion, so new height = new width × original height ÷ original width, and a width of 1280 gives a height of 720. The CSS output is aspect-ratio: 16 / 9; and the older padding-top technique uses height ÷ width × 100, here 56.25%, on a wrapper with no height of its own. Portrait sizes work the same way: 1080 × 1920 is 9:16.
When the ratio isn't a neat number
Real screen sizes are not always exact. 1366 × 768 reduces to 683:384, about 0.05% wider than 16:9, and 2560 × 1080 is 64:27, which the tool matches to 2.39:1 (0.82% narrower) even though it's marketed as 21:9. Scaling 1366 × 768 to a width of 1280 gives a height of 719.65, so pick a rounding mode: nearest whole number for images, or nearest even number for video, because many encoders need even dimensions.
Accuracy and data handling
Review colours, dimensions and visual settings in the real component, type size and target display. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I calculate an aspect ratio?
Divide the width and height by their greatest common divisor. For 1280 × 1024 that's 256, giving 5:4. Enter the two numbers and the ratio appears straight away.
What height is a 16:9 image that's 1280 pixels wide?
1280 × 9 ÷ 16 = 720, so the image is 1280 × 720. Enter 1920 and 1080 as the original size and 1280 as the new width to get the same answer.
Why choose the nearest even number?
Video encoders such as H.264 with 4:2:0 chroma subsampling need even widths and heights. Rounding to an even number avoids encoder errors or automatic cropping when you export.
More Design Tools
Related toolsDesign a CSS box-shadow with offsets, blur, spread, opacity and inset, previewed live.
Round each corner separately and get the shortest CSS border-radius shorthand.
Calculate PPI, pixel pitch and physical size from a screen's resolution and diagonal.
Pick or paste a colour and get HEX, RGB, HSL, HWB, HSV and CMYK codes at once.
Create linear, radial and conic CSS gradients, including gradient text, with a live preview.
Make a 50–900 colour scale or a colour-wheel scheme and export it as CSS, SCSS or Tailwind.