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
Run — free
Worked example
- Length
- 100
- 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.
FAQ
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.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/golden-ratio \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"length":100}'const res = await fetch("https://api.kit.forhosting.com/math/golden-ratio", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"length": 100
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/golden-ratio",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"length": 100
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/golden-ratio", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"length":100}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"length":100}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/golden-ratio", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"length": 100
}Example response
{
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
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.
Integration use cases
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.
Technical questions
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.