Fibonacci number calculator

Binet's formula gives the nth Fibonacci number in closed form from the golden ratio. Because it involves sqrt(5), it is computed here at 45 digits and then rounded to the exact integer.

Fibonacci number
832 040
≈ Rounded Fibonacci number
The one before it
514 229
Ratio to the previous term Converges on the golden ratio, 1.6180339887...
1.618 033 988 748 203 621 3
Before rounding
832 040
Show the working
  1. n = 30
  2. root5 = sqrt(5) = 2.236 07
  3. psi = (1 - 2.236 07) / 2 = -0.618 034
  4. Before rounding = (phi^30 - -0.618 034^30) / 2.236 07 = 832 040
  5. Fibonacci number = round(832 040) = 832 040
  6. The one before it = 30 > 0 ? round((phi^(30-1) - -0.618 034^(30-1)) / 2.236 07) : 0 = 514 229
  7. Ratio to the previous term = 514 229 > 0 ? 832 040 / 514 229 : 0 = 1.618 03

Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.

Scenarios & local history

Compare a saved scenario

Recent calculations

    The formula

    • F(n) = (phi^n - psi^n) / sqrt(5), with phi = (1+sqrt5)/2 and psi = (1-sqrt5)/2
    • The result is always an integer, which is why the raw value rounds cleanly.

    A double-precision implementation of this formula starts returning the wrong integer around n = 71. This one does not.

    Related calculators

    Settings

    Theme

    System follows your operating system and changes with it.

    Text size
    High contrast

    Maximises text and border contrast and removes the grid background.

    Graph-paper background

    Round to
    Notation
    Thousands separators
    Decimal mark
    Nearest fraction

    Shows the result as the nearest tape-measure fraction, with the error it costs.


    Accessibility & interaction
    Reduce motion Stops interface animations even when the operating system does not.
    Underline links Keeps links visually distinct without relying on colour.
    Larger touch targets Makes buttons and form controls easier to tap.
    Shorter reading lines Limits article width for easier scanning.
    Monochrome display Removes colour as an information cue.
    Always-visible focus Makes the keyboard focus ring persistent and stronger.
    Verbose screen-reader results Announces the complete conversion equation.
    Sticky action bars Keeps converter and calculator actions within reach.
    Select values on focus Replaces a value immediately when you start typing.
    Left-handed mobile layout Moves key mobile actions toward the left thumb.

    Your data

    Settings, recent conversions and favourites live in this browser only. Nothing is sent anywhere.

    Offline library