Aspect Ratio Calculator

Convert between ratio and dimensions

Size

The ratio is calculated from the width and height

Ratio Presets

Choosing a preset or custom ratio turns on ratio lock and updates the dimensions from the long side.

Ratio

16:9
Decimal ratio
1.78:1
Orientation
Landscape
1920 × 1080 px

Code

Code format
aspect-ratio: 16 / 9;

What is Aspect Ratio Calculator?

Enter a width and height to find the aspect ratio, or lock a ratio to calculate the matching dimension. Ratios calculated from dimensions appear as a simplified label and as a decimal value.

For a 16:9 video at 1280px wide, lock the ratio and enter the width to get a height of 720px. You can then convert the ratio into a CSS aspect-ratio value or a Tailwind class and take it into your code.

How to Use

  1. Enter the width and height.
  2. Turn on “Lock ratio” when you want to change one dimension while keeping the current ratio.

Choose a preset ratio, or select “Custom” to enter your own. Copy the CSS aspect-ratio value or Tailwind class if you need it.

Main Settings

Lock Ratio

When enabled, changing one dimension calculates the other from the current ratio. When disabled, the ratio is calculated from the width and height. The option is off by default.

Ratio Presets

Choose a preset for a common ratio. Selecting a preset applies the ratio using the larger of the current dimensions. Choosing a portrait preset for a landscape size, for example, keeps the long side and swaps the orientation.

Custom Ratio

For a ratio that is not in the presets, enter the width and height terms as integers. For example, 16 and 9 are treated as 16:9. Changing a term updates the dimensions using the larger of the current dimensions.

Swap Dimensions

Swaps the width and height. When the ratio is locked, the direction of the ratio is swapped as well.

Use Cases

  • Checking whether an image or video is 16:9, 4:3, or another ratio
  • Finding a width or height that keeps the ratio for a social media image or thumbnail
  • Converting a design ratio into a CSS or Tailwind value
  • Checking the size of a vertical version of a video

Things to Keep in Mind

  • Dimensions are handled as integers from 1 to 100000
  • When the ratio is locked, changing a dimension rounds the result to an integer, so the ratio can shift slightly