How the ratio and the missing side are calculated
An aspect ratio is width divided by height, written in its smallest whole numbers. The calculator finds the greatest common divisor (GCD) of the two dimensions with the Euclidean algorithm and divides both by it. It also shows the decimal value, width / height, to three places. The pixel sizes must be whole numbers greater than 0; a blank, zero or fractional field shows a message instead of a result.
With "Lock a ratio and solve one dimension" ticked, you choose a preset (16:9, 4:3, 21:9, 1:1, 3:2 or 9:16) or type a custom ratio (both sides must be greater than 0), say which side you know, and the other side is solved and rounded to the nearest whole pixel:
- known width:
height = round(width × ratioH / ratioW) - known height:
width = round(height × ratioW / ratioH)
Worked examples
1920 × 1080: the GCD is 120, so the ratio is 16:9 and the decimal is 1.778. A laptop panel of 1366 × 768 has a GCD of 2, which gives 683:384. That is a clumsy ratio, but it is the honest one: the screen is only approximately 16:9, because a true 16:9 panel 768 pixels tall would be 768 × 16 / 9 = 1365.33 pixels wide, and 1366 is the nearest whole number. To resize a 1000 px wide 16:9 image, the height is 1000 × 9 / 16 = 562.5, which rounds to 563.
Why a "21:9" screen does not simplify to 21:9
Ultrawide monitors are marketed as 21:9, but the pixel grids are close to it rather than exact. The 21:9 preset solves with the true 21:9 ratio (2.333), and its resolution list is labelled "ultrawide (~21:9)" because those panels are not exactly that shape. Entering the real resolutions shows it:
| Resolution | Simplified ratio | Decimal |
|---|---|---|
| 2560 × 1080 | 64:27 | 2.370 |
| 3440 × 1440 | 43:18 | 2.389 |
| 3840 × 1600 | 12:5 | 2.400 |
| 1920 × 1200 | 8:5 (often written 16:10) | 1.600 |
| 1080 × 1350 | 4:5 | 0.800 |
The same effect hits 1366 × 768. If a layout has to match an exact ratio, calculate the second side from the ratio instead of assuming a "marketing" ratio fits your pixel grid.
Mistakes and limits
- Rounding drift. Because the solved side is rounded, 1081 wide at 16:9 gives 608 (exactly 608.0625). Over a few hundred pixels this is invisible, but encoders such as H.264 also want even dimensions, so pick sizes that divide cleanly.
- Odd custom ratios. A custom ratio of whole numbers is reduced with the same GCD step, so 32:18 is shown as simplifying to 16:9 and solves identically. Decimals are accepted in the ratio boxes and used as typed, but they are not reduced. A blank or zero side shows a message.
- Portrait versus landscape. 9:16 is not the same as 16:9; swap width and height and the ratio flips. The common-resolutions list shows sizes for whichever preset is selected.
- Ratio is not size. 1280 × 720 and 3840 × 2160 are both 16:9. The ratio tells you shape only, so pixel density and file size are separate questions.
To act on a result, scale a picture in the image resizer, or turn pixel sizes into relative CSS units with the PX to REM converter.