Aspect ratio calculator
1920 by 1080 reduces to 16:9, a decimal ratio of 1.7778, and resizing it to 1280 wide keeps it undistorted at 720 high. Enter any width and height to check a video, display or image format before you export it. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Width
- 1,920
- Height
- 1,080
- Ratio width
- 16
- Ratio height
- 9
- Aspect ratio
- 16:9
- Decimal value
- 1.7778
free online
How a ratio like 16:9 is worked out
An aspect ratio describes the shape of a picture or screen, not its size. To find it, the calculator takes the width and the height and divides both by the largest whole number that fits exactly into each of them, the greatest common divisor. For 1920 by 1080 that leaves 16 and 9, written as 16:9. It also gives the decimal form, the width divided by the height, which is 1.7778 at the default four decimals. Nothing comes from a table of known formats, so any pair of sizes, in pixels or another unit, is reduced the same way, and an unusual screen gets its exact ratio.
Resizing without distortion, and what to watch
To resize while keeping the same shape, enter one new side and let the calculator work out the other. With a 1920 by 1080 master and a delivery width of 1280, the matching height is 720. You can give a new width or a new height, never both. Before reducing, the calculator drops any fractional part of the width and height, while the decimal ratio is computed from the exact values you typed. Use it to confirm that a resolution really is 16:9 or 4:3 before encoding a video or cropping an image.
How the ratio is reduced
The core reads width and height as numbers, truncates each to its absolute integer part (wi and hi), and reduces the pair with the Euclidean greatest-common-divisor routine gcd2. Alongside the reduced pair the tool returns decimal, computed as width divided by height and rounded to your requested precision, so 1920/1080 becomes 1.7778 at the default four decimals. The reduction runs on the truncated integers, meaning fractional inputs are floored before the gcd step, while the decimal ratio is computed from the original floating-point values.
What you can do with it
Video and display fitting
Confirm a resolution reduces to 16:9 or 4:3 before encoding, and scale a master frame to a delivery width while keeping the exact proportional height.
FAQ
How are non-integer widths handled?
The gcd reduction truncates each side to its integer part, while the decimal ratio is computed from the original floating-point width and height.
How do I keep the proportions when resizing to a new width?
Enter the new width and the tool computes the height as new width times original height divided by original width. A 1920 by 1080 frame resized to 1280 wide needs a height of 720.
Can I enter both a new width and a new height?
No. Give only one of them and the tool works out the other, so the shape stays the same. Supplying both at once is refused with a message asking for just one.
What does the decimal ratio mean?
It is the width divided by the height, rounded to the number of decimals you choose, four by default. For 1920 by 1080 that gives 1.7778, the same shape written as a single number.
Does it only know common ratios such as 16:9 or 4:3?
No. There is no list of preset formats: any width and height are reduced by their greatest common divisor, in pixels or any other unit, so unusual sizes get an exact ratio too.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/dev/aspect-ratio \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"width":1920,"height":1080}'const res = await fetch("https://api.kit.forhosting.com/dev/aspect-ratio", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"width": 1920,
"height": 1080
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/dev/aspect-ratio",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"width": 1920,
"height": 1080
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/dev/aspect-ratio", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"width":1920,"height":1080}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"width":1920,"height":1080}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/dev/aspect-ratio", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"width": 1920,
"height": 1080
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "dev.aspect_ratio",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Takes a width and height in pixels (or any unit) and returns the simplified integer ratio such as 16:9, the decimal ratio width/height, and, when you pass target_width or target_height, the matching scaled dimension that preserves the same proportions.
How the ratio is reduced
Dividing both sides by that gcd yields ratio_w and ratio_h, which are joined into the ratio string such as 1920 and 1080 collapsing to 16:9. Every output field, ratio_w, ratio_h, ratio and decimal, comes straight from these two operations with no lookup tables or preset ratio lists.
Scaling to a target width or height
Omit both target fields and the output simply carries the ratio and decimal without any scaled_ pair. Pass target_width when you know the new width and need the proportional height: the tool sets scaled_width to your target_width and computes scaled_height as target_width times height divided by width, rounded to your decimals. Pass target_height instead and it does the mirror, deriving scaled_width as target_height times width divided by height while scaled_height echoes your target. You may supply only one of the two; providing both target_width and target_height together is rejected with an invalid_input error carrying the message about supplying only one. This is the field you use to resize a 1920x1080 frame to a 1280 width and read back the exact 720 height that keeps it undistorted, or to fit an image into a fixed column while preserving its shape.
Validation, limits and rounding
The optional decimals parameter is an integer from 0 to 8 and defaults to 4; a value outside that range is rejected rather than clamped. Width and height must each be finite numbers greater than zero and no larger than 1e12; anything outside that window, including zero, negatives, NaN or a non-number, throws a typed invalid_input error naming the offending field.
Integration use cases
Responsive image layout
Feed a container width as target_width to get the height that preserves an asset's shape, avoiding letterboxing or stretched thumbnails in a CMS.
Batch validation via API
Call the endpoint over a media library to flag files whose ratio_w:ratio_h drifts from the intended aspect, using the deterministic JSON as the source of truth.
Technical questions
What ratio does 1920x1080 return?
16:9, with ratio_w 16, ratio_h 9, and decimal 1.7778 at the default four decimals.
Can I set both target_width and target_height?
No. Supply at most one; sending both returns an invalid_input error asking for only one target dimension.
How is rounding done?
An explicit half-up rule to your decimals value (0 to 8, default 4), matching the API exactly rather than using toFixed.
Is the browser widget free?
Yes, the on-page widget is free (tier A). The API path runs on prepaid KIT balance from $0.002 and only successful tasks are charged.