html69// developer tools

CSS tool

Aspect Ratio Calculator / Image Aspect Ratio Calculator

Do you want CSS Clamp Generator?

An aspect ratio calculator that is also an image aspect ratio calculator. 16:9, 4:3, 1:1, and 9:16 stay on this page, not extra URLs. Drop a photo to preview it, or two photos to compare ratios. Solve the missing side, simplify with GCD, copy CSS. It all stays on your computer.

Like the tool? Find a bug?Get in touch :)

Calculator

Supported files: .png, .jpg, .jpeg, .jfif, .gif, .webp, .bmp, .ico

An aspect ratio calculator and image aspect ratio calculator. Enter width, height, or a preset like 16:9. Paste 1920x1080 or 16 9. Drop one image to preview it, or two images to compare ratios. Numbers stay on your device.

px
px

Ratio

:

1.7778:1

Images

Image A

Html6916:9

1920 x 1080

Image B

Drop a second image to compare aspect ratio

Compare

Upload or drop two images. Image A drives the calculator and shows in the preview. Image B is the compare side. Both stay on your computer.

Common sizes at 16:9

aspect-ratio: 16 / 9;
aspect-video
.box {
  width: 1920px;
  aspect-ratio: 16 / 9;
}
.box {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
}

.box > * {
  position: absolute;
  inset: 0;
}
export function sizeAtRatio(width: number) {
  return {
    width,
    height: (width * 9) / 16,
  };
}

Runs on your computer. We never see what you paste or upload.

Guide

How this aspect ratio calculator works

01

Width, height, or ratio

Change width and height follows the ratio. Change height and width follows. Change 16:9 and the height updates from the current width. GCD simplifies 1920x1080 to 16:9.

02

Presets, not extra pages

16:9, 4:3, 1:1, and 9:16 live as buttons here, along with 21:9 and 3:2. Paste 16 9, 16 x 9, or 16 by 9. Drop one image to preview it and read its pixel size. Drop a second image to compare ratios.

03

CSS, Tailwind, or a padding hack

Copy aspect-ratio: 16 / 9;, Tailwind aspect-video, a width plus ratio rule, or the older padding-bottom box. Need fluid type next? Use the clamp generator linked below.

FAQ

Questions

How do I calculate aspect ratio?

Divide width by height, then simplify with the greatest common divisor. 1920 / 1080 is 16 / 9. Height from a 16:9 width is width x 9 / 16. A 1920-wide 16:9 frame is 1080 tall.

What is 16:9? What about 9:16?

16:9 is the common HD landscape ratio (1920x1080, 1280x720). 9:16 is the same pair flipped for stories and shorts (1080x1920). Load those presets instead of opening a separate 16 9 aspect ratio calculator page.

Can I calculate an image aspect ratio?

Yes. Upload or drop a PNG, JPG, or WebP. The photo shows in the preview. Width and height come from the file in this tab. You can also type the pixel size by hand.

Can I compare two image aspect ratios?

Yes. Upload two files, or drop a second image onto Image B. Matching ratios stay matching even when pixel size differs, such as 1920x1080 vs 1280x720. Both files stay in this tab.

Does this upload my image?

No. Math, preview, image size, and copy run in this tab. We never see it. It stays on your computer.

Share