ForHosting KIT · Video

Compute video aspect ratio crop

Reframing video for a new display format starts with one precise question: which centered rectangle preserves the greatest possible area while matching the destination aspect ratio?

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

This calculator accepts the source video's pixel width and height plus a target such as 9:16, 1:1, or 16:9. It returns the crop origin and dimensions without uploading, decoding, resizing, or changing the video. The geometry can be passed directly into an editing workflow, transcoding command, media pipeline, or preview interface.

Convert a source frame into the largest matching crop

Enter the decoded video's width and height in pixels, then provide the destination ratio in width-to-height form with a colon between the values. For example, 1920 by 1080 describes a common landscape frame, while 9:16 requests a vertical result suitable for short-form mobile video. The calculator compares the source ratio with the requested ratio and preserves whichever source dimension already constrains the fit. If the source is too wide, it keeps the full height and reduces the width. If the source is too tall, it keeps the full width and reduces the height. This choice produces the largest rectangle that can fit inside the original frame without stretching, padding, or extending beyond its edges. The returned x and y locate the crop's upper-left corner, and width and height describe its size. Together, those four values form a complete crop box for each frame in a constant-resolution video. No media bytes are needed because only the frame geometry participates in the calculation.

Understand centered coordinates and fractional pixels

A centered crop removes equal amounts from opposite edges. When a landscape source must become narrower, x equals half of the discarded horizontal area and y remains zero. When the frame must become shorter, y equals half of the discarded vertical area and x remains zero. Some dimension and ratio combinations produce fractional coordinates or sizes. That result is intentional: the exact mathematical center or exact requested ratio may fall between physical pixel boundaries. Returning decimal geometry avoids silently choosing a rounding policy that may not match your encoder, graphics library, or editing application. Values are normalized to nine decimal places so repeated requests remain stable and floating-point noise does not leak into manifests or tests. If your downstream tool accepts integers only, apply its documented rounding policy at the integration boundary and verify the final encoded dimensions. Integer rounding can move an edge slightly or make the realized ratio differ by a fraction of a pixel, especially with small frames or unusual decimal ratios.

Use the crop safely in video production workflows

Treat the response as reusable geometry rather than as a transformed video. Supply x, y, width, and height to the crop stage in your transcoder, nonlinear editor, canvas renderer, thumbnail generator, or media service. Confirm that the receiving tool uses an upper-left origin with x increasing to the right and y increasing downward, which is the convention used here. Read width and height from the actual decoded video stream, not from a filename, player viewport, or stale asset record. Rotated phone recordings may carry orientation metadata, so decide whether your pipeline applies that rotation before or after cropping and provide dimensions from the same stage where the crop will run. The ratio parser deliberately accepts only two positive finite numeric components separated by a colon. Misspellings, alternative separators, zero values, negative values, and extra text are rejected instead of guessed. That strict behavior is useful in automated batch jobs because a malformed preset fails immediately rather than producing a large collection of incorrectly framed outputs. Identical inputs always return identical geometry.

Reframe landscape video for vertical channels

Calculate the maximum centered 9:16 region before encoding platform-specific versions of a landscape master.

Standardize video thumbnail framing

Use one deterministic crop calculation for previews and thumbnails that must fill a fixed player shape without padding.

Validate an automated transcoding preset

Preview crop coordinates from source metadata and reject malformed ratio settings before expensive media processing begins.

Does this tool upload or modify the video?

No. It uses only width, height, and ratio values to return geometry; it does not receive, decode, store, or transform media.

How much does the calculation cost?

The API price is $0.002 per request. The same deterministic calculation can also run in the browser.

Which aspect ratio syntax is accepted?

Use two positive numbers separated by a colon, such as 9:16, 16:9, 1:1, or 1.85:1. Other separators and extra text are invalid.

Why can the crop contain decimal pixel values?

An exact center or ratio can lie between pixel boundaries. Decimal geometry preserves the mathematically largest centered crop without imposing a rounding policy.

Can the crop extend beyond the source frame?

No. One crop dimension always equals the corresponding source dimension, and the other is reduced to fit the requested ratio.

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.

POSThttps://api.kit.forhosting.com/video/aspect-ratio-crop

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.

curl -X POST https://api.kit.forhosting.com/video/aspect-ratio-crop \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"width":1920,"height":1080,"ratio":"9:16"}'
{
  "width": 1920,
  "height": 1080,
  "ratio": "9:16"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "video.aspect_ratio_crop",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb500
max_minutes60
max_megapixels3.9
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →