Negabinary (Base −2) Converter — Decimal ⇄ Base Negative Two

Convert any decimal integer to and from negabinary (base −2) — a positional system whose place values alternate sign (…16, −8, 4, −2, 1), so it stores positive and negative numbers with no sign bit. See the digit string, the signed positional expansion, the conversion steps, and plain binary for contrast. Live, two-way, runs entirely in your browser.

Converter Number Systems Updated Jun 21, 2026
How to Use
  1. Pick which side you are typing in — a decimal integer, or a negabinary digit string of 0s and 1s.
  2. Type your value; the other side updates instantly along with plain binary for contrast.
  3. Click any value (or its Copy button) to copy it to the clipboard.
  4. Open “Show work” to see the repeated-division encode steps and the alternating-sign positional expansion.

Numbers without a sign bit

Negabinary — base −2 — is a positional number system that uses the same two digits as ordinary binary, 0 and 1, but whose column values are powers of a negative radix: …, 16, −8, 4, −2, 1. Because every other place value is negative, a single uniform set of digits can describe positive numbers, negative numbers and zero with no sign bit, no two’s-complement word width and no overflow convention. The number 6 is 11010₋₂ and −3 is 1101₋₂; both are read by the exact same rule. This converter runs entirely in your browser on BigInt arithmetic, so arbitrarily large integers convert exactly, and it shows plain binary alongside for contrast.

How the conversion works

Negabinary → decimal is a signed positional expansion: multiply each digit by its place value and add. 11010₋₂ = 1·16 + 1·(−8) + 0·4 + 1·(−2) + 0·1 = 6. Decimal → negabinary is repeated division by the base −2 with a forced non-negative remainder. While n ≠ 0: set r = n mod 2 clamped to {0, 1} (in code, r = ((n % 2) + 2) % 2, or equivalently n & 1n on a BigInt), prepend r to the answer, then update n = (n − r) / (−2). The forced-positive remainder is the whole trick: it is what lets the quotient swing negative and back, walking the value down to zero while the alternating place values absorb the sign. Reading the prepended remainders top-to-bottom gives the digit string.

Negabinary vs. plain binary

In base 2 every place value is positive, so binary alone can only count from zero upward — representing a negative number needs an extra convention layered on top (a sign-and-magnitude bit, or two’s complement at a fixed width). Base −2 folds the sign into the place values themselves, which is elegant but comes at a cost: the digit strings are longer and less regular, addition has awkward carries that can ripple in both directions, and there is no quick “shift to multiply” because shifting multiplies by −2, not 2. That trade-off is why negabinary stays a teaching tool and a puzzle curiosity rather than a mainstream machine representation — but it is a memorable demonstration that the radix of a positional system is just a choice, and that the choice can even be negative.

Quick reference

Place values
…16, −8, 4, −2, 1 = (−2)ⁿ
Encode step
r = n mod 2; n = (n−r) / −2
Decode
Σ digit × (−2)ⁿ
6 in base −2
11010 = 16 − 8 − 2
−3 in base −2
1101 = −8 + 4 + 1
No sign bit
one rule covers + and −

About the Negabinary (Base −2) Converter — Decimal ⇄ Base Negative Two

Meet the Negabinary (Base −2) Converter — Decimal ⇄ Base Negative Two: a free, no-fuss tool for everyday tasks with nothing to install and no sign-up. Convert any decimal integer to and from negabinary (base −2) — a positional system whose place values alternate sign (…16, −8, 4, −2, 1), so it stores positive and negative numbers with no sign bit. See the digit string, the signed positional expansion, the conversion steps, and plain binary for contrast. Live, two-way, runs entirely in your browser.

How it works

Type a value, then pick what you want to change it into. The answer appears straight away. It all happens on your own device, so it is fast and nothing you type is sent away. Just check that you picked the right “from” and “to” so you get the answer you wanted.

Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.

Frequently Asked Questions

What is negabinary?

Negabinary, or base −2, is a positional number system that uses only the digits 0 and 1 but whose place values are powers of −2: …, (−2)⁴ = 16, (−2)³ = −8, (−2)² = 4, (−2)¹ = −2, (−2)⁰ = 1. Because half of those place values are negative, the system can represent every integer — positive, negative or zero — without a separate sign bit or two’s-complement convention.

How do I convert a decimal number to negabinary by hand?

Repeatedly divide by the base −2, but always keep a non-negative remainder of 0 or 1. While n ≠ 0: take r = n mod 2 (forced to 0 or 1), prepend r to the result, then set n = (n − r) / (−2). For example 6 → r0, n=−3 → r1, n=2 → r0, n=−1 → r1, n=1 → r1, n=0, giving 11010 read top-to-bottom of the prepended digits.

How do I read a negabinary number back to decimal?

Multiply each digit by its place value, a power of −2, and add them up. So 11010 = 1·16 + 1·(−8) + 0·4 + 1·(−2) + 0·1 = 16 − 8 − 2 = 6. The “Show work” panel writes out this signed expansion for you.

Why use base −2 instead of two’s complement?

It is mostly a mathematical curiosity, but a neat one: a single uniform positional rule covers signed integers, so there is no special sign bit, no fixed word width, and no overflow ambiguity. Donald Knuth and others have discussed it, and it occasionally appears in puzzles, esoteric hardware and arbitrary-precision arithmetic.

Is anything uploaded?

No. The conversion runs entirely in your browser with JavaScript using BigInt, so it handles arbitrarily large integers and nothing is ever sent to a server.

How do I use the Negabinary (Base −2) Converter — Decimal ⇄ Base Negative Two?

Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

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 non-standard positional systems

See how alternating-sign place values let one digit string encode both signs, with the expansion spelled out term by term.

Programming puzzles & code golf

Negabinary shows up in competitive-programming and esolang challenges; check your encoder against known vectors quickly.

Teaching number bases

Contrast base −2 with plain base 2 side by side to show that the choice of base radix — even a negative one — is just a convention.

Arbitrary-precision experiments

BigInt-backed conversion means very large positive and negative integers convert exactly, with no word-size limit.

Last updated: