# Aspect Ratio Calculator

> Reduces a width and height to their simplest ratio and decimal value, identifies the closest common ratio (16:9, 4:3, 3:2, 21:9 …) and scales the dimensions to a new width or height while keeping the ratio.

- Calculator id: `aspect-ratio` · Category: Everyday Life (`everyday`) · Tool name: `calculate_aspect_ratio`
- Canonical page: https://tttkmbb.com/everyday/aspect-ratio · This document: https://tttkmbb.com/everyday/aspect-ratio.md · JSON definition: https://tttkmbb.com/everyday/aspect-ratio.json

## Purpose

Reduces a width and height to their simplest ratio and decimal value, identifies the closest common ratio (16:9, 4:3, 3:2, 21:9 …) and scales the dimensions to a new width or height while keeping the ratio.

**Use when:** You need the aspect ratio of an image, screen or video, or the matching height for a new width (or width for a new height) when resizing.

**Do not use when:** You need pixel density, file size or a crop to a different ratio; this only keeps the existing proportions.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `width` | number |  | required | Width in any unit (pixels, cm …). (> 0, max 1000000000) |
| `height` | number |  | required | Height in the same unit. (> 0, max 1000000000) |
| `new_width` | number |  | optional | Optional target width; the matching height is returned as scaled_height. (> 0, max 1000000000) |
| `new_height` | number |  | optional | Optional target height; the matching width is returned as scaled_width. (> 0, max 1000000000) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `ratio` | string |  | Simplest integer ratio width:height (values with decimals are scaled to integers first). |
| `ratio_decimal` | number |  | width / height. |
| `closest_common_ratio` | string |  | Nearest of 1:1, 5:4, 4:3, 3:2, 16:10, 16:9, 1.85:1, 2:1, 21:9, 2.39:1 (or their portrait forms), by ratio. |
| `orientation` | string |  | landscape, portrait or square. |
| `scaled_height` | number |  | new_width × height / width (only when new_width is given). |
| `scaled_width` | number |  | new_height × width / height (only when new_height is given). |

## Formula

`ratio = (width / g) : (height / g) with g = gcd(width, height); ratio_decimal = width / height; scaled_height = new_width × height / width; scaled_width = new_height × width / height`

## Data Sources

- Aspect ratio (image) (Wikipedia) — https://en.wikipedia.org/wiki/Aspect_ratio_(image) (reference, retrieved 2026-09-23)
- Display aspect ratio (Wikipedia) — https://en.wikipedia.org/wiki/Display_aspect_ratio (reference, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/aspect-ratio?width=…&height=…`
- `POST https://tttkmbb.com/api/v1/calculate/aspect-ratio` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/aspect-ratio · OpenAPI operationId `calculate_aspect_ratio` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "aspect-ratio", "inputs": {…}}`

## Example

- 1920 × 1080, resize to width 1280: inputs `{"width":1920,"height":1080,"new_width":1280}` → `{"ratio":"16:9","ratio_decimal":1.7778,"closest_common_ratio":"16:9","orientation":"landscape","scaled_height":720}`
- 1080 × 1350 portrait, resize to height 675: inputs `{"width":1080,"height":1350,"new_height":675}` → `{"ratio":"4:5","ratio_decimal":0.8,"closest_common_ratio":"4:5","orientation":"portrait","scaled_width":540}`

```
GET https://tttkmbb.com/api/v1/calculate/aspect-ratio?width=1920&height=1080&new_width=1280
```

## Limitations

You need pixel density, file size or a crop to a different ratio; this only keeps the existing proportions. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Why is my 1366 × 768 screen shown as 683:384 and not 16:9?**

683:384 is the exact simplified ratio (1.7786); it is only approximately 16:9 (1.7778), which is why closest_common_ratio is reported separately.

**Scaled dimensions are not whole pixels. What should I do?**

Round to the nearest integer (or to an even number for video codecs); the tiny change in ratio is invisible.

## Related

- [Ratio Calculator](https://tttkmbb.com/math/ratio.md) — General ratio simplification and scaling.
- [Rectangle Calculator](https://tttkmbb.com/geometry/rectangle.md) — Area and diagonal of the frame.
