Aspect ratio calculator
Simplify a width and height to a ratio such as 16:9, and scale to a new width or height.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/aspect-ratio \
-H 'Content-Type: application/json' \
-d '{"input":{"width":1920,"height":1080,"target_width":1280}}'
import json, urllib.request
body = {'input': {'width': 1920, 'height': 1080, 'target_width': 1280}}
request = urllib.request.Request("https://setget.net/v1/tools/aspect-ratio", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/aspect-ratio", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"width":1920,"height":1080,"target_width":1280}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "aspect-ratio",
"input": {
"width": 1920,
"height": 1080,
"target_width": 1280
}
}
{
"input": {
"width": 1920,
"height": 1080,
"target_width": 1280
}
}
Endpoint: POST /v1/tools/aspect-ratio. Over MCP: run_tool with slug: "aspect-ratio".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
width |
number | yes | The original width. |
height |
number | yes | The original height. |
target_width |
number | no | A new width, to get the matching height. |
target_height |
number | no | A new height, to get the matching width. |
Examples
Input
{
"width": 1920,
"height": 1080,
"target_width": 1280
}Result
{
"ratio": "16:9",
"ratio_width": 16,
"ratio_height": 9,
"decimal": 1.7778,
"orientation": "landscape",
"nearest_common": "16:9",
"target": {
"width": 1280,
"height": 720
}
}Nearly 16:9
Input
{
"width": 1366,
"height": 768
}Result
{
"ratio": "683:384",
"ratio_width": 683,
"ratio_height": 384,
"decimal": 1.7786,
"orientation": "landscape",
"nearest_common": "16:9",
"target": null
}Questions
- Why is 1366 x 768 not exactly 16:9?
- Because 1366 / 768 is 1.7786, not 1.7778. The exact ratio is 683:384, and "nearest_common" tells you it is closest to 16:9.
- Are the target sizes rounded?
- To two decimal places. Round to whole pixels yourself if you need to.
Related tools
- Fraction and decimal converterConvert a decimal to a fraction or a fraction to a decimal, simplify a/b, and show mixed numbers.
fraction - Unit converterConvert between units of length, mass, temperature, area, volume, speed, time, data, pressure, energy and more.
unit-convert - Percentage calculatorWork out percentages: X% of Y, what percent X is of Y, percent change, and increase or decrease by X%.
percent - Add or subtract time from a dateAdd or subtract years, months, weeks, days, hours and minutes from a date and get the resulting date.
date-add - Age calculatorWork out an exact age in years, months and days on a given date, plus the next birthday.
age-calculator - Business days calculatorCount the working days between two dates, or add working days to a date, skipping weekends and holidays.
business-days