Calculation happens in your browser

Every calculator on this site is a pure function running locally in JavaScript. There is no server doing the arithmetic, no API call, and nothing to wait for. The mathematics lives in a separate, framework-independent layer covered by unit tests, so the same functions are verified directly rather than through the interface.

Precision and rounding

Calculations retain full floating-point precision internally. Rounding happens once, at the point of display. No calculation is ever chained from an already-rounded figure — where one tool hands values to another, it passes the precise value rather than the number you can see.

ResultDisplayed as
Pixel dimensionsWhole pixels
PPI1 decimal place
Pixel pitch3 decimal places, in millimetres
Inches and centimetresUp to 2 decimal places
MillimetresUp to 1 decimal place
Percentages1 decimal place
MegapixelsUp to 2 decimal places
Aspect ratio as a decimalUp to 4 decimal places

Unnecessary trailing zeroes are removed, so a whole result reads as a whole number.

Rounding direction

Ordinary pixel results round to the nearest whole pixel. TheRequired Resolution Calculator is the single exception: it rounds up, so the resolution it returns always meets or exceeds the density you asked for. Rounding to nearest there could leave a print fractionally short of its target.

Unit conversion

All physical conversion routes through millimetres using the exact international definition:1 inch = 25.4 mm. This is a definition, not a measurement, so conversions are exact up to the limits of floating-point arithmetic. Switching units never changes the underlying physical size — only how it is expressed.

Exact, conventional and rounded values

Ratio & Rule distinguishes four kinds of number, and tries never to blur them:

  • Calculated values — derived from your input by the formulas shown on each page.
  • Defined constants — exact by international agreement, such as the inch and the ISO A-series paper sizes.
  • Conventional guidance — widely used working values such as 300 PPI for photographic printing. These are starting points, always editable, and never presented as requirements.
  • Display values — the rounded form of a calculated value, shown for readability only.

Common-ratio detection

A familiar name such as 16:9 is only applied when your dimensions simplify to it exactly. Nothing is nudged towards the nearest marketing ratio. 3440 × 1440 simplifies to 43:18 and is reported as 43:18, even though it is sold as 21:9. The exact simplified ratio is always the primary truth.

Sourced constants

Constants that come from outside the mathematics are held in one place with their source recorded:

ConstantValueSource
International inch25.4 mm exactlyNIST / international yard and pound agreement, 1959
A4210 × 297 mmISO 216
A3297 × 420 mmISO 216
A5148 × 210 mmISO 216
CSS reference pixel96 PPIW3C CSS Values and Units
Print working density300 PPICommon photographic print guidance; conventional, not a standard

What the calculators assume

  • Pixels are square.
  • Screen size means the diagonal of the active display area. Bezels, chassis, stands and curvature are not estimated.
  • A display's physical proportions match the resolution you enter.
  • Crop figures assume a centred crop.
  • Drawings show proportion. Nothing on screen is calibrated to real physical size.

What Ratio & Rule will not tell you

No quality verdicts. A density figure is a measurement, so you will not find labels such as “retina”, “excellent” or “ideal” attached to one here. Whether a screen looks sharp or a print looks good depends on viewing distance, the source image, the hardware and the medium — none of which a calculator can observe.

Privacy

Values you type stay in your browser. They are never transmitted, stored or sent to analytics. The only time a value leaves your machine is when you deliberately copy a result link and share it, because that link carries your inputs in its query string so the recipient sees the same result. Theprivacy page describes exactly what is and is not collected.

Testing

The calculation layer is covered by unit tests for known answers and by invariant tests for properties that must always hold — that a screen's calculated width and height reconstruct its diagonal, that comparing a screen with itself yields zero difference, that print size and required resolution invert each other, and that no valid input path can produce a nonsensical result.