Zeckendorf / Fibonacci Coding Converter — Integer ↔ Fibonacci Representation
Convert any positive integer into its unique Zeckendorf representation — the sum of non-consecutive Fibonacci numbers — and its Fibonacci code bitstring, or decode a bitstring back to an integer. Live, in your browser, with BigInt support for huge numbers.
How to Use
- Choose whether you are entering a decimal integer or a Fibonacci-coded bitstring.
- Type your value — the Zeckendorf sum, bitstring and Fibonacci code update instantly.
- Read the chosen Fibonacci numbers under the place-value header; no two are ever adjacent.
- Click any result (or its Copy button) to copy it.
A number system built on Fibonacci numbers
Ordinary binary writes a number as a sum of powers of two. The Zeckendorf representation does the same thing with Fibonacci numbers instead: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … . Zeckendorf’s theorem (1972) proves that every positive integer is the sum of a unique set of non-consecutive Fibonacci numbers — you never need two that sit next to each other in the sequence, and there is exactly one valid way to do it. For example 100 = 89 + 8 + 3 and 17 = 13 + 3 + 1. This tool finds that decomposition, draws it against a Fibonacci place-value header, and converts back the other way. Everything runs in your browser with BigInt, so there is no size limit and nothing is uploaded.
From the bitstring to a self-delimiting code
Mark a 1 in every column whose Fibonacci value is used and a 0 in the rest, smallest Fibonacci on the left, and you get the Zeckendorf bitstring. Because the chosen Fibonacci numbers are never adjacent, this bitstring can never contain “11” — that is the signature of a valid Zeckendorf code. Fibonacci coding exploits exactly this: it appends one extra 1 to the end of the bitstring, so the resulting codeword contains a single “11” pair that unambiguously marks where it stops. A decoder can therefore pull integers out of a continuous bitstream without storing any length, which makes Fibonacci coding a compact, robust universal code for small numbers in data compression.
How the greedy algorithm works
The decomposition is found greedily: take the largest Fibonacci number ≤ the remaining value, subtract it, then skip the next-smaller Fibonacci number (which guarantees the “non-consecutive” property), and repeat until nothing is left. Greedy is provably optimal here, so it always returns the one true Zeckendorf representation. Decoding reverses it — read off the Fibonacci place value beneath every 1 bit and add them up.
Quick reference
About the Zeckendorf / Fibonacci Coding Converter — Integer ↔ Fibonacci Representation
Working on everyday tasks? The Zeckendorf / Fibonacci Coding Converter — Integer ↔ Fibonacci Representation is a free browser tool that gives you the answer in seconds. Convert any positive integer into its unique Zeckendorf representation — the sum of non-consecutive Fibonacci numbers — and its Fibonacci code bitstring, or decode a bitstring back to an integer. Live, in your browser, with BigInt support for huge numbers.
How it works
Enter a number and choose your units — the converted value shows instantly. Everything runs locally, so nothing you type leaves your device. Double-check the direction of the conversion and you are set.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
What is a Zeckendorf representation?
Zeckendorf’s theorem says every positive integer can be written in exactly one way as a sum of non-consecutive Fibonacci numbers (using each Fibonacci number at most once, and never two that are next to each other in the sequence 1, 2, 3, 5, 8, 13, …). For example 100 = 89 + 8 + 3. This tool finds that unique decomposition with a greedy algorithm.
How is that different from the Fibonacci code?
The Zeckendorf <em>bitstring</em> places a 1 in each column whose Fibonacci value is used and a 0 elsewhere, written with the smallest Fibonacci number on the left. Because no two chosen Fibonacci numbers are adjacent, the bitstring never contains “11”. The Fibonacci <em>code</em> used for self-delimiting encoding takes that bitstring and appends one extra 1 as a terminator — so the only “11” in the whole codeword marks its end, which lets a decoder find boundaries in a stream without a length prefix.
Which Fibonacci numbers are used?
The Zeckendorf set starts 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … — that is the Fibonacci sequence with the duplicate leading 1 removed, so each value is distinct. Standard binary uses powers of two for place values; Zeckendorf uses these Fibonacci numbers instead.
How does the greedy algorithm work?
Repeatedly take the largest Fibonacci number that is less than or equal to what remains, subtract it, and skip the next-smaller Fibonacci number. Repeat until nothing is left. Greedy is guaranteed optimal here: it always yields the unique non-consecutive representation.
How big a number can it handle?
The whole calculation uses JavaScript BigInt, so there is no practical upper limit — you can convert numbers with hundreds of digits and the Fibonacci place values grow to match. Everything runs locally in your browser; nothing is uploaded.
How do I use the Zeckendorf / Fibonacci Coding Converter — Integer ↔ Fibonacci Representation?
Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Learning number theory
See Zeckendorf’s theorem in action — watch the unique non-consecutive Fibonacci decomposition build for any integer.
Data compression study
Explore Fibonacci coding, a self-delimiting universal code used to store small integers compactly without a length field.
Puzzles & competitive maths
Quickly check Zeckendorf decompositions and the “no two consecutive Fibonacci numbers” property for contest problems.
Teaching the golden ratio
Connect Fibonacci numbers, the golden ratio and an alternative positional number system in a single hands-on demo.
Last updated: