Fibonacci number calculator
The 10th Fibonacci number is 55, counting F1 and F2 as 1. Enter a position up to 10000 and get the exact term, even when it runs to hundreds of digits, or ask for every term up to it in one go. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 10
- Value
- 55
The Fibonacci sequence is the classic recurrence where each term is the sum of the two before it. This calculator uses the one-based convention F1 equals one and F2 equals one, so the sequence begins one, one, two, three, five, eight, thirteen, and so on—the indexing most students meet in contest problems and programming exercises. You supply a positive integer index n; the service returns the exact n-th term as a decimal string computed with BigInt arithmetic, so values far beyond ordinary floating-point or safe-integer limits stay correct digit for digit. When you need more than a single term, enable the optional list flag to receive the entire prefix F1 through Fn as an array of decimal strings. Negative indices and zero are rejected with a clear validation error rather than a silent wrong answer.
How the n-th Fibonacci number is defined and computed
We use the one-based Fibonacci indexing with F1 equal to one and F2 equal to one. Every later term satisfies Fk equals F(k−1) plus F(k−2) for k greater than or equal to three. Under that rule F3 is two, F4 is three, F5 is five, F6 is eight, F7 is thirteen, F8 is twenty-one, F9 is thirty-four, and F10 is fifty-five—the familiar classroom prefix.
The implementation never uses Binet’s formula or floating-point approximation; instead it walks the recurrence with BigInt addition from the first two terms up to n, which guarantees every digit is exact even when the result has hundreds of decimal places. The path is fully deterministic—no random seeds, no clocks, no network, and no model drift—so the same n always yields the same string and the same optional sequence.
Where Fibonacci calculations show up in real work
Data and analytics teams sometimes need deterministic integer sequences as synthetic keys, load-test ladders, or demo datasets; an exact string sequence avoids off-by-one mistakes between F0-based and F1-based codebases once the convention is fixed on the landing page. Product demos, coding interviews, and blog posts about dynamic programming often show a short Fibonacci table; listing F1 through Fn in one call keeps interactive demos honest without reimplementing the loop in every language.
If you later need modular Fibonacci, Lucas numbers, Zeckendorf representations, or matrix exponentiation for astronomical n, treat those as separate search intents rather than overloading this calculator landing.
What you can do with it
Synthetic sequences in pipelines
Pull deterministic Fibonacci values into tests, demos, or load ladders without reimplementing BigInt addition in every service.
FAQ
Why is value a string instead of a number?
Fibonacci numbers grow past JavaScript safe integers by F93. Decimal strings keep every digit exact for large n.
How do I get the full sequence F1 through Fn?
The response includes sequence as an array of decimal strings.
What happens if n is below 1?
Fibonacci index n must be at least 1 under this convention.
What does it cost?
The browser tool is free and runs locally.
Does the sequence start at F0 or F1?
It starts at F1, with F1 and F2 both equal to 1, so F3 is 2 and F10 is 55. Keep that in mind if your textbook or code counts from F0, because every position shifts by one.
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/fibonacci \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":10}'const res = await fetch("https://api.kit.forhosting.com/math/fibonacci", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/fibonacci",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/fibonacci", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/fibonacci", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.fibonacci",
"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.
Limits
min_n | 1 |
max_n | 10000 |
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
The free browser tool and the paid API share one pure function, so homework demos and automated pipelines never silently diverge.
How the n-th Fibonacci number is defined and computed
Returning the value as a decimal string keeps JSON consumers honest: large Fibonacci numbers leave the safe-integer range of ordinary JavaScript numbers by F93, and a numeric type would silently round. Bounds keep n between one and ten thousand so worst-case latency stays suitable for a free in-browser tool and a lightweight Worker path.
What you send and what you get back
The error for n below one states that the Fibonacci index must be at least one so form clients and scripts can correct the input without guessing. On success the response always includes the normalized n and value as the exact n-th Fibonacci number written in decimal. Provide a required positive integer under the field n, or the aliases number or index. The value must be an integer from one through ten thousand inclusive; missing fields, non-integers, decimals, and any n below one are rejected with invalid_input and are not charged. Optionally set list to true (aliases sequence and include_sequence are accepted) to request the full prefix F1 through Fn. When list is true, the response also includes sequence: an array of n decimal strings starting with the first term. Example checks: n equals one yields value one and, if listed, sequence of a single one; n equals two yields value one and sequence one, one; n equals ten yields value fifty-five and the ten-term prefix ending in fifty-five; n equals zero or negative yields invalid_input.
Where Fibonacci calculations show up in real work
Finance and growth storytelling sometimes misuse Fibonacci-style ratios; an exact sequence endpoint does not invent market signals, but it does give educators a clean reference when they contrast true recurrence values with heuristic “Fibonacci levels.” Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Contest and homework fixtures
Generate exact F(n) strings and optional F1..Fn prefixes for olympiad problems, programming exercises, and automated answer keys.
Teaching the recurrence with real digits
Show students the full sequence as decimal strings so large terms stay exact and the F1=F2=1 convention is visible, not abstract.
Technical questions
What indexing does this Fibonacci calculator use?
One-based with F1 = 1 and F2 = 1. Then F3 = 2, F4 = 3, F5 = 5, and so on. Zero and negative indices are rejected.