ForHosting KIT · Math

Golden ratio calculator

Split a length in the ratio phi and get both pieces at once: 100 becomes 61.803399 and 38.196601, and the larger divided by the smaller gives phi, about 1.618034. Pixels, millimetres or points all work. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Length
100
You get
Major
61.803399
Minor
38.196601
Ratio
1.618034
Major over minor
1.618034

split a segment into its golden-ratio parts

How the split in the ratio phi is worked out

Cut a segment so that the whole is to the larger piece as the larger piece is to the smaller one, and the proportion you land on is phi. Solving that condition gives one plus the square root of five, divided by two: about 1.618034. The calculator uses that exact value, divides your length by phi to get the larger piece and subtracts it from the length to get the smaller one. With a length of 100, the larger piece is 61.803399 and the smaller one is 38.196601. Every figure is rounded to six decimals, so the same length always gives the same digits.

Where the split is used, and two checks

This split sits behind the classic rectangles and logarithmic spirals built on phi, and behind the proportions of a design or a page layout. Because it is a pure proportion, the unit does not matter: pixels, millimetres, points or em come back in the same unit you typed. Two checks come with every answer. The larger piece divided by the smaller one gives phi again, and the two pieces add back to your original length. A frequent slip is to confuse which piece is which; here the larger piece is always the one closest to the full length.

The proportion behind phi

Cut a segment so that the ratio of the whole to the larger piece equals the ratio of the larger piece to the smaller piece, and the number you get is phi — approximately 1.618034. Written as an equation, (a + b) / a = a / b = phi, and solving it gives the irrational value (1 + sqrt(5)) / 2. Because the relationship is definitional, the major part divided by the minor part always equals phi, and the two parts always add back to the original length.

Any unit works — pixels, millimetres, points, em — because the split is a pure proportion and the parts come back in the same unit you sent.

How the computation works

There is no approximation search and no iteration: phi is computed analytically as (1 + Math.sqrt(5)) / 2 in double precision, the major part is a single division, and the minor part is a single subtraction. The result is then rounded to six decimal places so the output is stable byte for byte across machines — a raw floating-point division can differ in the last bit between CPUs, which would make automated comparisons brittle.

What value of phi do you use?

Phi is computed analytically as (1 + sqrt(5)) / 2 in double precision and reported rounded to six decimal places as the ratio field.

Which part is the major one?

The major part is the length divided by phi (about 61.8% of the total); the minor part is the remainder (about 38.2%). Together they always add back to the input length.

What units does it accept?

Any. The length is a unitless number, so pixels, millimetres, points or em all work; the parts come back in the same unit.

Is the result deterministic?

Yes. It is a pure analytic computation with no randomness, dates or network calls, so the same input always returns the same output.

Can the length be zero or negative?

No. The length has to be a positive number; zero, a negative value or text instead of a number is refused, because a segment with no length cannot be split in the ratio phi.

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/math/golden-ratio

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/math/golden-ratio \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"length":100}'
{
  "length": 100
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.golden_ratio",
  "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.

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.

This API takes a segment of any positive length and returns that split for you: the major part, the minor part, and the ratio itself, all rounded for stable reuse.

What the golden ratio actually means

The endpoint returns both checks alongside the parts, so a consumer can verify the construction instead of trusting it.

How the computation works

The output object carries the echoed length, the major and minor parts, the ratio phi itself, the derived ratio major_over_minor, and a check_sum equal to major plus minor that should reproduce your input. Validation is strict: the length must be a finite positive number, and anything else — zero, a negative value, a missing field, a non-numeric string — is rejected with an invalid_input error that names the offending field, without charging you.

Where the split is used

Whatever the use, the endpoint is a pure function — same input, same output, no state, no network — which makes it safe to call from pipelines, spreadsheets, and build scripts, and free to try in the browser on this page before you automate anything.

Split a layout width

Divide a 1440 px content area into a golden major column and minor sidebar with exact pixel values.

Place a focal point in a composition

Cut a canvas width or height at the golden section so a subject sits on the natural division line.

Implement golden-section search

Get the interior split of an optimisation interval at the correct phi proportion for each iteration.

What does it cost?

$0.002 per request via the API. It is also free to run in your browser on this page.

What happens with zero or a negative length?

The request is rejected with an invalid_input error naming the length field. Errors are not charged.

Read the full KIT documentation →