Negabinary Converter (Base -2)
Decimal
Binary (base 2)
Negabinary (base -2)
Other Data Tools
Negabinary Converter - Convert Numbers to Base -2 (Negabinary)
What is negabinary (base -2)?
Negabinary is a positional number system with a radix of -2. It uses only the digits 0 and 1, but each place alternates between positive and negative powers, so it can represent positive and negative integers without a separate minus sign or sign bit.
How does decimal-to-negabinary conversion work?
Decimal-to-negabinary conversion repeatedly divides by -2 while keeping the remainder as 0 or 1. For example, decimal 9 becomes negabinary 11001, because the place values add up as 16 - 8 + 1 = 9.
How does negabinary-to-decimal conversion work?
Negabinary-to-decimal conversion is a weighted sum. Starting from the rightmost bit, each digit is multiplied by (-2)^i, then the values are added together. The string 11 equals -2 + 1, which is decimal -1.
What is the difference between binary and negabinary?
Binary uses base 2, so its place values are 1, 2, 4, 8, and so on. Negabinary uses base -2, so its place values are 1, -2, 4, -8, 16, and so on. That alternating sign is why base -2 can encode negative integers with only 0 and 1.
Why does every integer have a unique negabinary representation?
Every integer can be reduced by repeatedly choosing a 0 or 1 remainder and dividing the adjusted value by -2. The process eventually reaches zero, and the resulting bit sequence is unique when leading zeros are ignored.
Where is negabinary used?
Negabinary is mostly useful in computer science education, theoretical number systems, coding puzzles, and competitive programming. Negative-base arithmetic also appears in historical computing discussions, including the ternary Setun computer family, and in research around alternate number representations.
How large can the input be?
This negabinary converter uses BigInt arithmetic in your browser, so it is not limited by JavaScript's usual 2^53 - 1 safe integer boundary. Very large decimal, binary, and negabinary integers can be converted without floating-point precision loss.
Can I convert binary to negabinary?
Yes. Choose Binary (base 2) as the source base, enter a 0/1 binary string, and the tool will show the decimal and negabinary forms together. For broader text-oriented base conversions, try the Base64 encoder and decoder.
What are common negabinary conversion pitfalls?
Leading zeros are allowed, but they do not change the value. Do not add a sign bit to negabinary numbers; negative values are represented by the base -2 place values themselves. If you are converting ordinary signed decimal numbers, use the decimal source mode.
Does the converter work privately in my browser?
Yes. The conversion runs fully in your browser with no upload step and no account. If you are also cleaning or reshaping structured data, the JSON formatter is another in-browser data tool that pairs well with quick numeric conversion work.