ForHosting KIT · Images

Rule of thirds grid calculator

The rule-of-thirds grid calculator turns an image width and height into precise pixel coordinates for two vertical lines, two horizontal lines, and their four intersection points.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Use the result to place composition guides in an editor, camera interface, crop tool, design system, or automated image workflow. The calculation preserves fractional coordinates when a dimension is not divisible by three, preventing silent rounding and letting the drawing environment choose the most suitable rendering behavior.

What the rule-of-thirds coordinates represent

A rule-of-thirds overlay divides a rectangular image into three equal columns and three equal rows. This calculator places the vertical guides at one third and two thirds of the supplied width, then places the horizontal guides at one third and two thirds of the supplied height. Crossing those guides produces four intersection points, often used as reference positions for a subject, face, horizon detail, or other visual anchor. The returned coordinates use the image's top-left corner as the origin: x increases from left to right, and y increases from top to bottom. That convention matches common raster graphics, canvas, browser, and image-editing coordinate systems. The response keeps the original width and height alongside separate vertical line, horizontal line, and intersection arrays, making each part easy to consume. It does not inspect image pixels, judge a composition, crop an image, or move any subject. It provides deterministic geometry that another application can draw, store, compare, or use as composition guidance.

How fractional pixels and validation are handled

Each coordinate is calculated directly from the full dimension without intermediate rounding. For a width of 1200 pixels, the vertical guides fall exactly at x values 400 and 800. For a width of 1000 pixels, they fall at 333.3333333333333 and 666.6666666666666 in JavaScript number form. Preserving those fractions matters because rendering systems differ: a vector canvas can draw at subpixel positions, while a raster pipeline may prefer floor, ceiling, nearest-integer, or device-aware alignment. Applying an arbitrary rounding rule inside the calculator would remove that choice and could make one outer region wider than another. Width and height must both be finite positive integers because they describe raster image dimensions. A zero dimension is explicitly rejected, as required, since a line grid over an image with no width or height has no useful geometric area. Negative values, fractions, missing fields, strings, infinities, and non-numeric values are also rejected with an invalid-input response rather than producing misleading coordinates.

Using the result in editors and automated workflows

To draw an overlay, render each vertical guide from y equals zero to the full height at its returned x coordinate, and render each horizontal guide from x equals zero to the full width at its returned y coordinate. The four returned intersection points can be drawn as handles, targets, markers, or snapping references without recomputing combinations. In a responsive preview, run the calculator against the actual pixel dimensions of the image rather than the CSS display size, then scale the coordinates by the same factor used to display the image. In a crop workflow, calculate against the crop rectangle after the crop dimensions are known, because the thirds belong to the final frame. The function is pure and has no network calls, randomness, timestamps, image decoding, or stored state, so identical inputs always produce identical JSON. That makes it suitable for browser tools, server-side validation, tests, batch metadata generation, and reproducible design pipelines. Browser use is free; an API request costs $0.002 when the same calculation is integrated into an automated system.

Draw guides in an image editor

Convert the active canvas dimensions into line coordinates for a consistent rule-of-thirds overlay.

Add composition targets to a camera preview

Position four focus or subject-placement markers from the current preview resolution without hard-coded offsets.

Validate crop layouts

Compute the thirds of a proposed crop so an automated workflow can compare important subject coordinates with composition guides.

What coordinates are returned?

The result contains two vertical x positions, two horizontal y positions, and the four points where those lines intersect.

Where is the coordinate origin?

The origin is the top-left corner of the image. X increases to the right and y increases downward.

Are fractional pixel positions rounded?

No. Fractional results are preserved so the consuming renderer can choose its own subpixel or integer alignment policy.

What happens if width or height is zero?

The request fails with an invalid-input error because a zero-sized image cannot support a meaningful thirds grid.

What does an API request cost?

Each API request costs $0.002. The same deterministic calculation can also run free in the browser.

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/image/grid-overlay-thirds

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/image/grid-overlay-thirds \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"width":1200,"height":800}'
{
  "width": 1200,
  "height": 800
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "image.grid_overlay_thirds",
  "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_mb15
max_megapixels12
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 →