Aspect Ratio Rounding Error Calculator
At 16:9 and 1366 px wide, the exact height is 768.375 px. Floor and nearest give 768 px with +0.0488% ratio drift; ceil gives 769 px with -0.0813% drift; nearest even also gives 768 px. For this input, 768 is the lowest-drift integer and even result.
Best default result: 1366 × 768, drift +0.0488%Exact height: 768.375 px
| Rule | Size | Pixel error | Ratio drift | Cross-product delta |
|---|
The four results for 1366 px at 16:9
The unrounded height is 1366 × 9 / 16 = 768.375 px. Floor removes 0.375 px and returns 768. Nearest also returns 768 because the fractional part is below 0.5. Ceil adds 0.625 px and returns 769. Nearest-even means the closest height divisible by two; 768 is only 0.375 px away, while 770 is 1.625 px away.
| Rule | Height | Height error | Ratio drift |
|---|---|---|---|
| Floor | 768 | -0.375 px | +0.048828% |
| Nearest | 768 | -0.375 px | +0.048828% |
| Ceil | 769 | +0.625 px | -0.081274% |
| Nearest even | 768 | -0.375 px | +0.048828% |
The smallest absolute height error and the smallest absolute ratio drift both select 768 here. That does not make 1366 × 768 exact 16:9: its cross products are 1366 × 9 = 12,294 and 768 × 16 = 12,288, leaving a delta of +6.
How the calculator measures drift
Exact opposite edge: H* = Wb / a
Pixel error: e = Hr - H*
Relative ratio drift: d = ((W / Hr) / (a / b) - 1) × 100%
Integer audit: Δ = Wb - Hr a
Here a:b is the requested width-to-height ratio, W is the known width, and Hr is a rounded height. A positive drift means the rounded frame is wider than the requested ratio; a negative drift means it is narrower. A zero cross-product delta proves the pair is exact without depending on decimal precision.
Absolute drift is useful for ranking candidates, while signed drift preserves direction. The calculator highlights every rule tied for the lowest absolute drift; identical rows are intentional because floor, nearest, and nearest-even can converge on the same integer.
Rounding rules can disagree
For a 1000 px width at 3:2, the exact height is 666.666667 px. Floor and nearest-even return 666, producing +0.100100% drift. Nearest and ceil return 667, producing -0.049975% drift. In that case, nearest is more accurate than the even result by ratio drift, so requiring an even height has a measurable cost.
For 853 px at 16:9, the exact height is 479.8125. Floor gives 479 with +0.169624% drift. Nearest, ceil, and nearest-even all give 480 with -0.039063% drift. For 1920 px at 4:3, the exact height is already 1440, so all four rules return the same zero-error pair.
| Input | Floor | Nearest | Ceil | Nearest even |
|---|---|---|---|---|
| 1000 px, 3:2 | 666 (+0.1001%) | 667 (-0.0500%) | 667 (-0.0500%) | 666 (+0.1001%) |
| 853 px, 16:9 | 479 (+0.1696%) | 480 (-0.0391%) | 480 (-0.0391%) | 480 (-0.0391%) |
| 1920 px, 4:3 | 1440 (0%) | 1440 (0%) | 1440 (0%) | 1440 (0%) |
Which rounding rule should you use?
Use nearest when the goal is the smallest one-pixel approximation. Use floor when the result must not exceed a dimension limit. Use ceil when the result must not fall below a required edge. Use nearest-even when an encoder or pipeline requires an even output height. If exact rational dimensions matter more than keeping the known width fixed, move both edges to a shared integer multiple of the reduced ratio instead of rounding one edge.
The lowest numerical drift is not a substitute for an external delivery specification. If a service requires a fixed size, keep that size and use this calculator to document its error rather than silently replacing it.
Aspect ratio rounding questions
Does rounding one pixel change aspect ratio?
It can. The change may be small, but only equal cross products prove that the final integer dimensions retain the exact requested ratio.
Is nearest always better than floor or ceil?
Nearest minimizes edge distance, but a size cap, minimum edge, or even-dimension rule may require a different choice.
What does positive ratio drift mean?
The rounded width-to-height quotient is larger than the requested quotient, so the result is proportionally wider.
How is nearest even calculated?
This page rounds the exact height to the closest multiple of two using 2 × round(height / 2).
Sources
References checked on October 24, 2026: the W3C ratio definition, the MDN ratio data type, and the MDN rounding-strategy reference. The formulas, example calculations, comparisons, cross-product tests, and SVG above were independently produced for this page.