ForHosting KIT · Developer Utilities

Minimum bounding rectangle calculator for 2D points

The minimum bounding rectangle calculator finds the smallest axis-aligned rectangle that contains every supplied two-dimensional point.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

It returns all four corner coordinates together with the rectangle's width, height, and area. The calculation is useful when you need a compact spatial extent for plotting, indexing, collision checks, viewport selection, or data validation. Points may use negative, positive, integer, or decimal coordinates, and the result remains well defined for a single point or for points that lie on one horizontal or vertical line.

What an axis-aligned bounding rectangle means

An axis-aligned minimum bounding rectangle is the smallest rectangle that contains a point set while keeping its edges parallel to the x and y axes. It is determined by four extrema: the lowest and highest x coordinates and the lowest and highest y coordinates. Those values become the rectangle boundaries, even when the points that establish them are four different members of the set. The result therefore describes the complete spatial extent without assuming that the points are ordered, form a polygon, or trace a closed shape. This calculator reports the corners as bottom left, bottom right, top right, and top left, making the orientation explicit and convenient for drawing. Width is maximum x minus minimum x, height is maximum y minus minimum y, and area is their product. Unlike an oriented bounding box, this rectangle is never rotated to follow the apparent direction of the data. That distinction makes the result predictable, inexpensive to compute, and directly compatible with ordinary Cartesian plotting regions, canvas coordinates after any required axis conversion, and many spatial index structures.

How to prepare and interpret the points

Provide at least one point, with every point represented by an object containing finite numeric x and y fields. Coordinates can be negative or fractional, and duplicate points are accepted because they do not change the extrema. Keep all coordinates in the same coordinate system and unit: mixing meters with feet, or projected map coordinates with longitude and latitude, produces a numeric rectangle that has no coherent physical meaning. The calculator treats the values as Cartesian coordinates and does not wrap longitude at the antimeridian, project a globe, or infer map units. A single point produces four identical corners with zero width, height, and area. Points on a vertical line produce zero width, while points on a horizontal line produce zero height; both cases correctly have zero area. The corner names describe their mathematical relationship, so bottom means minimum y and top means maximum y. If a screen environment increases y downward, transform the coordinates for display rather than changing the calculation. Reviewing these conventions before integration prevents common errors involving swapped axes, strings that look numeric, and inconsistent units.

Using the result in spatial workflows

The returned rectangle is a compact first-stage summary for many geometry workflows. A chart can use its minimum and maximum coordinates to choose a viewport with optional padding. A spatial search can compare rectangles before running more expensive point, segment, or polygon tests, quickly rejecting objects whose extents cannot overlap. Data import pipelines can record width, height, and area as quality signals, revealing unexpectedly distant points or collapsed dimensions. Because the solver scans the list once, its running time grows linearly with the number of points and it does not need to sort or mutate them. The answer is deterministic: the same finite coordinates always produce the same field structure and numeric values. Remember that containment by bounding rectangles is only a coarse test. Two rectangles may overlap even when the underlying shapes do not, and the rectangle does not describe gaps, concavity, point density, or rotation. Use it as an extent, filter, or layout primitive, then apply a precise geometry operation when your decision depends on the actual shape rather than its axis-aligned envelope.

Fit a plot viewport

Derive the exact coordinate extent of a scatter plot before adding margins and selecting display scales.

Build a broad-phase spatial filter

Compare inexpensive axis-aligned bounds before performing detailed intersection or proximity calculations.

Validate coordinate imports

Flag point sets with implausible width, height, or area before they enter a mapping or analytics pipeline.

What does a request cost?

Each API request costs $0.002. The calculation uses a deterministic local algorithm with no external service.

Is this an oriented minimum bounding rectangle?

No. Its sides always remain parallel to the x and y axes; it does not rotate to minimize area.

What happens with only one point?

All four corners equal that point, and width, height, and area are zero.

Can coordinates be negative or decimal values?

Yes. Any finite numeric x and y values are accepted, including negative values and decimals.

Can I use latitude and longitude?

You can supply them as numbers for a simple numeric extent, but the solver is Cartesian and does not handle antimeridian wrapping or spherical geometry.

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/geo/min-bounding-rectangle

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/geo/min-bounding-rectangle \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points":[{"x":-2,"y":3},{"x":4,"y":-1},{"x":1,"y":5}]}'
{
  "points": [
    {
      "x": -2,
      "y": 3
    },
    {
      "x": 4,
      "y": -1
    },
    {
      "x": 1,
      "y": 5
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geo.min_bounding_rectangle",
  "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_points100000
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 →