Home › Everyday Life › Aspect Ratio Calculator
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.
When to use
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.
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
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
width | number | yes | Width in any unit (pixels, cm …). Range: > 0, ≤ 1000000000 | |
height | number | yes | Height in the same unit. Range: > 0, ≤ 1000000000 | |
new_width | number | no | Optional target width; the matching height is returned as scaled_height. Range: > 0, ≤ 1000000000 | |
new_height | number | no | Optional target height; the matching width is returned as scaled_width. Range: > 0, ≤ 1000000000 |
Outputs
| Output | 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). |
Example
1920 × 1080, resize to width 1280: {"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: {"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
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/aspect-ratio(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/aspect-ratio · Markdown: https://tttkmbb.com/everyday/aspect-ratio.md · JSON definition: https://tttkmbb.com/everyday/aspect-ratio.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="aspect-ratio" - OpenAPI operationId:
calculate_aspect_ratio - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Aspect ratio (image) (Wikipedia) (reference)
- Display aspect ratio (Wikipedia) (reference)
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 calculators
- Ratio Calculator — General ratio simplification and scaling.
- Rectangle Calculator — Area and diagonal of the frame.