---
title: "Aspect Ratio Calculator"
method: POST
path: "/api/v1/tools/aspect-ratio-calculator"
tags: ["tools"]
---

# Aspect Ratio Calculator

`POST /api/v1/tools/aspect-ratio-calculator`

## Request

- Base URL: `https://toolforte.com`
- URL: `https://toolforte.com/api/v1/tools/aspect-ratio-calculator`
- Auth: HTTP bearer

Reduce a width and a height to their aspect ratio, or work out the side that is missing at a given ratio so an image or a canvas keeps its proportions. Also returns the decimal ratio, the megapixels and whether the result is landscape, portrait or square.

## Request body

- object
  - `width` integer
  - `height` integer
  - `ratioWidth` integer
  - `ratioHeight` integer

## Response `200`

Successful result

- object
  - `ok` boolean
  - `data` object
    - `width` integer
    - `height` integer
    - `ratio` string
    - `ratioWidth` integer
    - `ratioHeight` integer
    - `decimal` number
    - `megapixels` number
    - `orientation` string
    - `solvedFor` string

## Other responses

- `400`: Missing or invalid request fields
- `401`: Invalid or missing API key
- `429`: Monthly plan limit reached

---

[API](https://skmtc.dev/toolforte/apis/toolforte-api.md) · [All operations](https://skmtc.dev/toolforte/apis/toolforte-api/llms.txt) · [OpenAPI document](https://skmtc.dev/toolforte/apis/toolforte-api/revisions/4d814d484dfc?raw)
