Closest Exact Aspect Ratio Size
For 16:9 under 1919 × 1080, the largest exact integer size is 1904 × 1071. Reduce the ratio, divide each limit by its matching ratio term, take the smaller floor, then multiply both terms by that same integer.
Direct answer: 16 × 119 by 9 × 1191904 × 1071
Audit the 1919 × 1080 calculation
First reduce 16:9. Its greatest common divisor is 1, so the primitive step remains 16 pixels wide by 9 pixels high. Every exact integer size must be 16k × 9k for a positive integer k. Width allows floor(1919 / 16) = 119 steps. Height allows floor(1080 / 9) = 120 steps. The rectangle must satisfy both limits, so k is the smaller value: 119.
Multiplication gives 16 × 119 = 1904 and 9 × 119 = 1071. Both are below the limits. The unused capacity is 1919 - 1904 = 15 pixels in width and 1080 - 1071 = 9 pixels in height. Exactness is independently verified by cross multiplication: 1904 × 9 = 17,136 and 1071 × 16 = 17,136.
The next exact pair would use k = 120, producing 1920 × 1080. It fails only the width constraint, by one pixel. That single failed boundary test proves 1904 × 1071 is not merely valid; it is the largest exact pair that fits.
The formula for any limits
Reduce A:B with g = gcd(A,B) to a=A/g and b=B/g.
Choose k = min(floor(Wmax/a), floor(Hmax/b)).
Return W=a×k and H=b×k.
Verify W×b = H×a.
Reduction matters. A requested 1920:1080 ratio reduces to 16:9, so valid pairs advance in 16-by-9 steps, not 1920-by-1080 jumps. The calculator uses Euclid's algorithm before choosing the multiplier.
This method answers a different question from proportional rounding. Rounding 1919 × 9 / 16 gives 1079.4375, but 1919 × 1079 is not exactly 16:9. The exact-size method deliberately steps down to the nearest pair whose two dimensions share one integer multiplier.
Five boundary tests
| Ratio | Limits | k | Largest exact size | Next pair fails |
|---|---|---|---|---|
| 16:9 | 1919 × 1080 | 119 | 1904 × 1071 | 1920 > 1919 |
| 4:3 | 1000 × 1000 | 250 | 1000 × 750 | 1004 > 1000 |
| 3:2 | 800 × 500 | 250 | 750 × 500 | 502 > 500 |
| 21:9 → 7:3 | 3440 × 1440 | 480 | 3360 × 1440 | 1443 > 1440 |
| 9:16 | 1080 × 1919 | 119 | 1071 × 1904 | 1920 > 1919 |
Each row checks both the returned pair and the next multiplier. The 21:9 row also tests reduction: gcd(21,9)=3, producing the primitive 7:3 step. A naive 21-by-9 step would miss valid larger sizes.
When to use this calculator
Use it when both output dimensions must be whole numbers and the result may not exceed a bounding box. It is useful for image pipelines, canvases, sprites, and video frames where exact proportion matters more than consuming every last pixel.
If an encoder requires even dimensions, an exact ratio may need an additional divisibility rule. That is a separate constraint: this page guarantees integer dimensions and exact aspect ratio, not codec compatibility.
Closest exact size questions
Why not round the missing dimension?
Rounding can create a near match, but cross multiplication will expose drift. This method only returns pairs that are mathematically proportional.
Does “closest” mean smallest pixel difference?
Here it means the largest exact pair that does not exceed either limit. It maximizes the shared integer multiplier.
Can the limits be portrait?
Yes. Width is always entered first and height second; the same formula handles portrait ratios.
What if no positive exact pair fits?
If either limit is smaller than its reduced ratio term, the calculator reports that no positive exact integer size fits.
Sources
References checked on October 28, 2026: the MDN ratio data-type reference, the MDN aspect-ratio reference, and the FFmpeg filter documentation. The algorithm, proofs, boundary tests, calculator, and SVG are original work for this page.